Repository: git-commit-id/git-commit-id-maven-plugin

Issue #215: Support of git worktree option (for JGIT)
Created: 2015-09-02T09:27:20Z
Hi, since git 2.5.0 worktree option allow to create many working tree linked to a single repository.
Building a linked working tree using  git-commit-id-plugin mojo failed because current git reference can't be retrieve. Seems to  be JGit issue, but I think it's useful to report here first.
Build exception :
[INFO] --- git-commit-id-plugin:2.1.15:revision (default)  ---
org.apache.maven.plugin.MojoExecutionException: Could not get HEAD Ref, are you sure you have some commits in the dotGitDirectory?
    at pl.project13.maven.git.JGitProvider.prepareGitToExtractMoreDetailedReproInformation(JGitProvider.java:106)
    at pl.project13.maven.git.GitDataProvider.loadGitData(GitDataProvider.java:98)
    at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit(GitCommitIdMojo.java:585)
    at pl.project13.maven.git.GitCommitIdMojo.loadGitData(GitCommitIdMojo.java:558)
    at pl.project13.maven.git.GitCommitIdMojo.execute(GitCommitIdMojo.java:376)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Duplicate issue #285: Does not work with git worktree
Created: 2017-06-09T20:00:08Z
Working directories created with https://git-scm.com/docs/git-worktree unfortunately use a .git file whose contents is the path of the real .git directory, and that breaks the check maven-git-commit-id does. The only workaround I found was to set failOnUnableToExtractRepoInfo. Ideally, maven-git-commit-id should use git itself to verify existence and query data in the .git dir.

Closing comment (2017-06-30T15:57:52Z): Not to be picky but this is pretty much a duplicate of
#215