Class GitScmTestUtils

java.lang.Object
org.apache.maven.scm.provider.git.GitScmTestUtils

public final class GitScmTestUtils extends Object
  • Field Details

  • 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

      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
    • setupRejectAllCommitsHook

      private static void setupRejectAllCommitsHook(File repositoryOrWorkspaceRootFile, boolean isServerSide, String hookName) throws IOException
      Throws:
      IOException