jgitver / jgitver-maven-plugin

maven core extension to automatically define versions using jgitver & git tags
https://jgitver.github.io/
Other
159 stars 41 forks source link

git worktree with jgitver #86

Open benjamingarcia opened 6 years ago

benjamingarcia commented 6 years ago

Issue

1.2.1: replace with the version of the jgtiver-maven-plugin you have the issue with

usage context:

Problem description:

[WARNING] cannot autoclose GitVersionCalculator object for project: /home/dev/projet/fix java.lang.IllegalStateException: failure calculating version at fr.brouillard.oss.jgitver.GitVersionCalculator.buildVersion (GitVersionCalculator.java:312) at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersionObject (GitVersionCalculator.java:144) at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersion (GitVersionCalculator.java:203) at fr.brouillard.oss.jgitver.GitVersionCalculator.meta (GitVersionCalculator.java:512) at fr.brouillard.oss.jgitver.JGitverExtension.afterSessionStart (JGitverExtension.java:93) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:210) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) 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) Caused by: org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index at org.eclipse.jgit.lib.Repository.getWorkTree (Repository.java:1356) at org.eclipse.jgit.treewalk.FileTreeIterator. (FileTreeIterator.java:115) at org.eclipse.jgit.treewalk.FileTreeIterator. (FileTreeIterator.java:97) at org.eclipse.jgit.api.StatusCommand.call (StatusCommand.java:139) at fr.brouillard.oss.jgitver.impl.GitUtils.isDirty (GitUtils.java:51) at fr.brouillard.oss.jgitver.GitVersionCalculator.buildVersion (GitVersionCalculator.java:209) at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersionObject (GitVersionCalculator.java:144) at fr.brouillard.oss.jgitver.GitVersionCalculator.getVersion (GitVersionCalculator.java:203) at fr.brouillard.oss.jgitver.GitVersionCalculator.meta (GitVersionCalculator.java:512) at fr.brouillard.oss.jgitver.JGitverExtension.afterSessionStart (JGitverExtension.java:93) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:210) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290) at org.apache.maven.cli.MavenCli.main (MavenCli.java:194) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) 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)



But I think it´s more about jGit [jgit issue](https://bugs.eclipse.org/bugs/show_bug.cgi?id=477475)
McFoggy commented 6 years ago

Hi Benjamin, thanks for reporting.

Indeed jgitver relies on jgit for that git parsing so if worktree breaks jgit, then jgitver is also broken.

chrko commented 4 years ago

This seems to be resolved by https://github.com/jgitver/jgitver/commit/e42d69b2aa2d05bd38433f50fd00d75153380412 Could you release a new version, please?