Class GitScmTestUtils
- java.lang.Object
-
- org.apache.maven.scm.provider.git.GitScmTestUtils
-
public final class GitScmTestUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGIT_COMMAND_LINE'git' command line.
-
Constructor Summary
Constructors Modifier Constructor Description privateGitScmTestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddeleteAllDirectories(java.io.File startDirectory, java.lang.String pattern)static java.lang.StringgetScmUrl(java.io.File repositoryRootFile, java.lang.String provider)static voidinitRepo(java.io.File repository, java.io.File workingDirectory, java.io.File assertionDirectory)static voidinitRepo(java.lang.String source, java.io.File repository, java.io.File workingDirectory)static voidsetDefaultGitConfig(java.io.File repositoryRootFile)static voidsetDefaultGitConfig(java.io.File repositoryRootFile, java.util.function.Consumer<java.io.FileWriter> configWriterCustomizer)private static voidsetupRejectAllCommitsHook(java.io.File repositoryOrWorkspaceRootFile, boolean isServerSide, java.lang.String hookName)static voidsetupRejectAllCommitsPreCommitHook(java.io.File workspaceRoot)static voidsetupRejectAllCommitsPrePushHook(java.io.File workspaceRoot)Sets up a pre-push git hook that rejects all commits for the given repository (client-side).static voidsetupRejectAllCommitsPreReceiveHook(java.io.File repositoryRootFile)Sets up a pre-receive git hook that rejects all commits for the given repository (server-side).
-
-
-
Field Detail
-
GIT_COMMAND_LINE
public static final java.lang.String GIT_COMMAND_LINE
'git' command line.- See Also:
- Constant Field Values
-
-
Method Detail
-
initRepo
public static void initRepo(java.io.File repository, java.io.File workingDirectory, java.io.File assertionDirectory) throws java.io.IOException- Throws:
java.io.IOException
-
initRepo
public static void initRepo(java.lang.String source, java.io.File repository, java.io.File workingDirectory) throws java.io.IOException- Throws:
java.io.IOException
-
getScmUrl
public static java.lang.String getScmUrl(java.io.File repositoryRootFile, java.lang.String provider) throws org.codehaus.plexus.util.cli.CommandLineException- Throws:
org.codehaus.plexus.util.cli.CommandLineException
-
deleteAllDirectories
public static void deleteAllDirectories(java.io.File startDirectory, java.lang.String pattern) throws java.io.IOException- Throws:
java.io.IOException
-
setDefaultGitConfig
public static void setDefaultGitConfig(java.io.File repositoryRootFile) throws java.io.IOException- Throws:
java.io.IOException
-
setDefaultGitConfig
public static void setDefaultGitConfig(java.io.File repositoryRootFile, java.util.function.Consumer<java.io.FileWriter> configWriterCustomizer) throws java.io.IOException- Throws:
java.io.IOException
-
setupRejectAllCommitsPreReceiveHook
public static void setupRejectAllCommitsPreReceiveHook(java.io.File repositoryRootFile) throws java.io.IOExceptionSets 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:
java.io.IOException- if there's an error creating or writing the hook file
-
setupRejectAllCommitsPrePushHook
public static void setupRejectAllCommitsPrePushHook(java.io.File workspaceRoot) throws java.io.IOExceptionSets 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:
java.io.IOException- if there's an error creating or writing the hook file
-
setupRejectAllCommitsPreCommitHook
public static void setupRejectAllCommitsPreCommitHook(java.io.File workspaceRoot) throws java.io.IOException- Throws:
java.io.IOException
-
setupRejectAllCommitsHook
private static void setupRejectAllCommitsHook(java.io.File repositoryOrWorkspaceRootFile, boolean isServerSide, java.lang.String hookName) throws java.io.IOException- Throws:
java.io.IOException
-
-