Class GitScmTestUtils
java.lang.Object
org.apache.maven.scm.provider.git.GitScmTestUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteAllDirectories(File startDirectory, String pattern) static Stringstatic voidstatic voidstatic voidsetDefaultGitConfig(File repositoryRootFile) static voidsetDefaultGitConfig(File repositoryRootFile, Consumer<FileWriter> configWriterCustomizer) private static voidsetupRejectAllCommitsHook(File repositoryOrWorkspaceRootFile, boolean isServerSide, String hookName) static voidsetupRejectAllCommitsPreCommitHook(File workspaceRoot) static voidsetupRejectAllCommitsPrePushHook(File workspaceRoot) Sets up a pre-push git hook that rejects all commits for the given repository (client-side).static voidsetupRejectAllCommitsPreReceiveHook(File repositoryRootFile) Sets up a pre-receive git hook that rejects all commits for the given repository (server-side).
-
Field Details
-
GIT_COMMAND_LINE
-
-
Constructor Details
-
GitScmTestUtils
private GitScmTestUtils()
-
-
Method Details
-
initRepo
public static void initRepo(File repository, File workingDirectory, File assertionDirectory) throws IOException - Throws:
IOException
-
initRepo
public static void initRepo(String source, File repository, File workingDirectory) throws IOException - Throws:
IOException
-
getScmUrl
-
deleteAllDirectories
- Throws:
IOException
-
setDefaultGitConfig
- Throws:
IOException
-
setDefaultGitConfig
public static void setDefaultGitConfig(File repositoryRootFile, Consumer<FileWriter> configWriterCustomizer) throws IOException - Throws:
IOException
-
setupRejectAllCommitsPreReceiveHook
Sets up a pre-receive git hook that rejects all commits for the given repository (server-side). This is useful for testing scenarios where you want to simulate a repository that doesn't allow any new commits. This hook is not supported by JGit.- Parameters:
repositoryRootFile- the root directory of the git repository- Throws:
IOException- if there's an error creating or writing the hook file
-
setupRejectAllCommitsPrePushHook
Sets up a pre-push git hook that rejects all commits for the given repository (client-side). This is useful for testing scenarios where you want to simulate a repository that doesn't allow any new commits.- Parameters:
workspaceRoot- the root directory of the git working copy- Throws:
IOException- if there's an error creating or writing the hook file
-
setupRejectAllCommitsPreCommitHook
- Throws:
IOException
-
setupRejectAllCommitsHook
private static void setupRejectAllCommitsHook(File repositoryOrWorkspaceRootFile, boolean isServerSide, String hookName) throws IOException - Throws:
IOException
-