Package pl.project13.core.util
Class GitDirLocator
java.lang.Object
pl.project13.core.util.GitDirLocator
This class encapsulates logic to locate a valid .git directory of the currently used project. If
it's not already specified, this logic will try to find it.
-
Constructor Summary
ConstructorsConstructorDescriptionGitDirLocator(File projectBasedir, boolean useNativeGit, boolean shouldFailOnNoGitDirectory) Constructor to encapsulates all references required to locate a valid .git directory -
Method Summary
Modifier and TypeMethodDescriptionlookupGitDirectory(File manuallyConfiguredDir) Attempts to lookup a valid .git directory of the currently used project.
-
Constructor Details
-
GitDirLocator
Constructor to encapsulates all references required to locate a valid .git directory- Parameters:
projectBasedir- The project basedir that will be used as last resort to search the parent project hierarchy until a .git directory is found.useNativeGit- Boolean that indicates if we use the native git implementation or the jGit Implementation. For the native git we usually need to use the parent "git"-Folder, as git can not run commands in "your-project/.git".shouldFailOnNoGitDirectory- Boolean that indicates if the process should fail if no git directory can be found.
-
-
Method Details
-
lookupGitDirectory
@Nullable public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) throws GitCommitIdExecutionException Attempts to lookup a valid .git directory of the currently used project.- Parameters:
manuallyConfiguredDir- A user has the ability to configure a git-directory with thedotGitDirectoryconfiguration setting. By default it should be simply${project.basedir}/.git- Returns:
- A valid .git directory, or
nullif none could be found under the user specified location or within the project or it's reactor projects. - Throws:
GitCommitIdExecutionException
-