Class GitCli
java.lang.Object
org.craftercms.studio.impl.v2.utils.git.GitCli
Allows doing Git operations throw the CLI.
If you ever use this class, please lock/synchronize the calls (hopefully with the
If you ever use this class, please lock/synchronize the calls (hopefully with the
GeneralLockService)- Since:
- 3.1.23
- Author:
- Sumer Jabri, Alfonso Vasquez
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected StringexecuteGitCommand(String directory, GitCli.GitCommandLine commandLine) protected StringexecuteGitCommand(String directory, GitCli.GitCommandLine commandLine, GitCliOutputExceptionResolver exceptionResolver) booleanisRepoClean(String directory) Remove the given paths from the index and discard changes
-
Field Details
-
DEFAULT_EX_RESOLVER
-
COMMIT_EX_RESOLVER
-
-
Constructor Details
-
GitCli
public GitCli() -
GitCli
public GitCli(String gitProcName, int gitProcWaitForTimeoutSecs, int gitProcDestroyWaitForTimeoutSecs)
-
-
Method Details
-
executeGitCommand
protected String executeGitCommand(String directory, GitCli.GitCommandLine commandLine) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
executeGitCommand
protected String executeGitCommand(String directory, GitCli.GitCommandLine commandLine, GitCliOutputExceptionResolver exceptionResolver) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
add
- Throws:
GitCliException
-
restore
Remove the given paths from the index and discard changes- Parameters:
directory- the git repository directorypaths- the paths to restore- Returns:
- the output of the git restore command
- Throws:
GitCliException
-
commit
public String commit(String directory, String author, String message, String... paths) throws GitCliException - Throws:
GitCliException
-
isRepoClean
- Throws:
GitCliException
-