def init(cls, repo_dir=None, temp=False, initial_commit=False):
        """Run `git init` in the repo_dir.

        Defaults to current working directory if repo_dir is not supplied.

        If 'temp' is True, a temporary directory will be created for you
        and the repository will be initialized. The tempdir is scheduled
        for deletion (when the process exits) through an exit function
        registered with the atexit module. If 'temp' is True, repo_dir is
        ignored.
        """
        if temp:
            suffix = '.temp_simpl_GitRepo'
            repo_dir = create_tempdir(suffix=suffix, delete=True)
        else:
            repo_dir = repo_dir or os.getcwd()
        git_init(repo_dir)
        instance = cls(repo_dir)

        # NOTE(larsbutler): If we wanted to be defensive about this and favor
        # compatibility over elegance, we could just automatically add a
        # `git commit` (empty, no message) after every `git init`. I would
        # recommend doing this in the :class:`GitRepo` class, not in the
        # module-level util functions. Adding an extra commit shouldn't cause
        # any problems.
        if initial_commit:
            # unknown revision, needs a commit to run most commands
            instance.commit(
                message='Initial commit', amend=False, stage=False)
        return instance
def init ( cls , repo_dir = None , temp = False , initial_commit = False ) : if temp : suffix = '.temp_simpl_GitRepo' repo_dir = create_tempdir ( suffix = suffix , delete = True ) else : repo_dir = repo_dir or os . getcwd ( ) git_init ( repo_dir ) instance = cls ( repo_dir ) if initial_commit : instance . commit ( message = 'Initial commit' , amend = False , stage = False ) return instance
Run `git init` in the repo_dir.

        Defaults to current working directory if repo_dir is not supplied.

        If 'temp' is True, a temporary directory will be created for you
        and the repository will be initialized. The tempdir is scheduled
        for deletion (when the process exits) through an exit function
        registered with the atexit module. If 'temp' is True, repo_dir is
        ignored.