Class InitCommand

    • Constructor Detail

      • InitCommand

        public InitCommand()
    • Method Detail

      • setDirectory

        public InitCommand setDirectory​(File directory)
                                 throws IllegalStateException
        The optional directory associated with the init operation. If no directory is set, we'll use the current directory
        Parameters:
        directory - the directory to init to
        Returns:
        this instance
        Throws:
        IllegalStateException - if the combination of directory, gitDir and bare is illegal. E.g. if for a non-bare repository directory and gitDir point to the same directory of if for a bare repository both directory and gitDir are specified
      • setGitDir

        public InitCommand setGitDir​(File gitDir)
                              throws IllegalStateException
        Set the repository meta directory (.git)
        Parameters:
        gitDir - the repository meta directory
        Returns:
        this instance
        Throws:
        IllegalStateException - if the combination of directory, gitDir and bare is illegal. E.g. if for a non-bare repository directory and gitDir point to the same directory of if for a bare repository both directory and gitDir are specified
        Since:
        3.6
      • setBare

        public InitCommand setBare​(boolean bare)
        Set whether the repository is bare or not
        Parameters:
        bare - whether the repository is bare or not
        Returns:
        this instance
        Throws:
        IllegalStateException - if the combination of directory, gitDir and bare is illegal. E.g. if for a non-bare repository directory and gitDir point to the same directory of if for a bare repository both directory and gitDir are specified
      • setFs

        public InitCommand setFs​(FS fs)
        Set the file system abstraction to be used for repositories created by this command.
        Parameters:
        fs - the abstraction.
        Returns:
        this (for chaining calls).
        Since:
        4.10
      • setInitialBranch

        public InitCommand setInitialBranch​(String branch)
                                     throws InvalidRefNameException
        Set the initial branch of the new repository. If not specified (null or empty), fall back to the default name (currently master).
        Parameters:
        branch - initial branch name of the new repository
        Returns:
        this
        Throws:
        InvalidRefNameException - if the branch name is not valid
        Since:
        5.11