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 String
GIT_COMMAND_LINE
'git' command line
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
deleteAllDirectories(File startDirectory, String pattern)
static String
getScmUrl(File repositoryRootFile, String provider)
static void
initRepo(File repository, File workingDirectory, File assertionDirectory)
static void
initRepo(String source, File repository, File workingDirectory)
static void
setDefaultGitConfig(File repositoryRootFile)
static void
setupRejectAllCommitsPrePushHook(File workspaceRoot)
Sets up a pre-push git hook that rejects all commits for the given repository (client-side).static void
setupRejectAllCommitsPreReceiveHook(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)
-
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
-
-