Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh: Find dotGitDirectory using rev-parse --show-toplevel #113

Open
louisburton opened this issue May 14, 2014 · 3 comments
Open

Enh: Find dotGitDirectory using rev-parse --show-toplevel #113

louisburton opened this issue May 14, 2014 · 3 comments

Comments

@louisburton
Copy link

I can see code that attempts to find the dotGitDirectory. It seems to look up the parent structure for the .git directory. However, many projects don't have the parent in the same project or the parent is not the same pom as the aggregator/reactor. When you have a nested maven module structure it is hard to determine where the .git directory is, when these sub modules are not git submodules (remotely source controlled). You may want to run builds from the reactor or an individual sub module, making the working directory unreliable also.

The following would get the .git directory I believe and I believe JGit supports the rev-parse command.

git rev-parse --show-toplevel

A quick google turns up other people that have hit this error and pulled out the plugin as a result.
https://jira.codehaus.org/browse/GEOT-4042
Sorry, I don't have a pull request right now - I use a workaround with relative paths from different modules.

@ktoso
Copy link
Collaborator

ktoso commented May 24, 2014

Hi and thanks for the info.
Yeah this would be cool to implement... maybe with the raise of the native impl.
Not sure if jgit supports the --shot-toplevel option though (yes, it does support rev-parse)

@maiergre
Copy link
Contributor

FWIW, git rev-parse --git-dir directly gives the git directory and automatically follows submodule links correctly.

@KTannenberg
Copy link

Following line can be used as a work-around:
<dotGitDirectory>${maven.multiModuleProjectDirectory}/.git</dotGitDirectory>

But this definitely wouldn't work correctly in case your maven project spans across multiple repositories using git submodules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants