Class GitScmTestUtils
- java.lang.Object
-
- org.apache.maven.scm.provider.git.GitScmTestUtils
-
public final class GitScmTestUtils extends Object
- Author:
- Trygve Laugstøl
-
-
Field Summary
Fields Modifier and Type Field Description static StringGIT_COMMAND_LINE'git' command line.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddeleteAllDirectories(File startDirectory, String pattern)static StringgetScmUrl(File repositoryRootFile, String provider)static voidinitRepo(File repository, File workingDirectory, File assertionDirectory)static voidinitRepo(String source, File repository, File workingDirectory)static voidsetDefaultGitConfig(File repositoryRootFile)static voidsetDefaultGitConfig(File repositoryRootFile, Consumer<FileWriter> configWriterCustomizer)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 Detail
-
GIT_COMMAND_LINE
public static final String GIT_COMMAND_LINE
'git' command line.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public static String getScmUrl(File repositoryRootFile, String provider) throws org.codehaus.plexus.util.cli.CommandLineException
- Throws:
org.codehaus.plexus.util.cli.CommandLineException
-
deleteAllDirectories
public static void deleteAllDirectories(File startDirectory, String pattern) throws IOException
- Throws:
IOException
-
setDefaultGitConfig
public static void setDefaultGitConfig(File repositoryRootFile) throws IOException
- Throws:
IOException
-
setDefaultGitConfig
public static void setDefaultGitConfig(File repositoryRootFile, Consumer<FileWriter> configWriterCustomizer) throws IOException
- Throws:
IOException
-
setupRejectAllCommitsPreReceiveHook
public static void setupRejectAllCommitsPreReceiveHook(File repositoryRootFile) throws IOException
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
public static void setupRejectAllCommitsPrePushHook(File workspaceRoot) throws IOException
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
public static void setupRejectAllCommitsPreCommitHook(File workspaceRoot) throws IOException
- Throws:
IOException
-
-