git-commit-id / git-commit-id-maven-plugin

Maven plugin which includes build-time git repository information into an POJO / *.properties). Make your apps tell you which version exactly they were built from! Priceless in large distributed deployments... :-)
http://www.kto.so
GNU Lesser General Public License v3.0
1.62k stars 299 forks source link

WARNING about unknown commit-graph chunk #687

Open khmarbaise opened 9 months ago

khmarbaise commented 9 months ago

Describe the bug (required)

[INFO] --- git-commit-id:7.0.0:revision (default) @ tree ---
[WARNING] unknown commit-graph chunk: 0x47444132
[WARNING] unknown commit-graph chunk: 0x47444132
[WARNING] unknown commit-graph chunk: 0x47444132
[WARNING] unknown commit-graph chunk: 0x47444132

Already done a git gc --prune=now etc.

$> git fsck --unreachable 
Checking object directories: 100% (256/256), done.
Checking objects: 100% (3261/3261), done.
Verifying commits in commit graph: 100% (323/323), done.

Tell us about your plugin configuration (required)

        <plugin>
          <groupId>io.github.git-commit-id</groupId>
          <artifactId>git-commit-id-maven-plugin</artifactId>
          <version>7.0.0</version>
          <configuration>
            <failOnNoGitDirectory>false</failOnNoGitDirectory>
            <runOnlyOnce>true</runOnlyOnce>
            <generateGitPropertiesFile>true</generateGitPropertiesFile>
            <commitIdGenerationMode>full</commitIdGenerationMode>
            <useBranchNameFromBuildEnvironment>false</useBranchNameFromBuildEnvironment>
          </configuration>
        </plugin>

Tell us about the Plugin version used (required)

7.0.0

Tell us about the Maven version used (required)

Steps to Reproduce (required)

mvn clean verify

Are there any stacktraces or any error messages? (required)

mvn clean verify
...
[INFO] 
[INFO] --- git-commit-id:7.0.0:revision (default) @ tree ---
[INFO] Current project: 'XYZ..', first project to execute based on dependency graph: 'XYZ...'
[INFO] dotGitDirectory '/Users/khm/xyz/.git'
[INFO] Collected git.build.user.name with value 
[INFO] Collected git.build.user.email with value 
[WARNING] unknown commit-graph chunk: 0x47444132
[INFO] Collected git.branch with value main
[INFO] Collected git.commit.id.describe with value 0b93ad0-dirty
[INFO] Collected git.commit.id.describe-short with value 0b93ad0-dirty
[INFO] Collected git.commit.id.full with value 0b93ad0c8c4ebf955108b85d6afda4428a5c11a3
[INFO] Collected git.commit.id.abbrev with value 0b93ad0
[INFO] Collected git.dirty with value true
[INFO] Collected git.commit.user.name with value Karl Heinz Marbaise
[INFO] Collected git.commit.user.email with value kama@soebes.de
[INFO] Collected git.commit.message.full with value Upgrade assertj-bom 3.25.1
[INFO] Collected git.commit.message.short with value Upgrade assertj-bom 3.25.1
[INFO] Collected git.commit.time with value 2024-01-03T17:29:20+0100
[INFO] Collected git.commit.author.time with value 2024-01-03T17:29:20+0100
[INFO] Collected git.commit.committer.time with value 2024-01-03T17:29:20+0100
[INFO] Collected git.remote.origin.url with value git@192.168.178.9:/home/git/repos/xyz.git
[WARNING] unknown commit-graph chunk: 0x47444132
[INFO] Collected git.tags with value 
[WARNING] unknown commit-graph chunk: 0x47444132
[INFO] Collected git.closest.tag.name with value 
[WARNING] unknown commit-graph chunk: 0x47444132
[INFO] Collected git.closest.tag.commit.count with value 
[INFO] Collected git.total.commit.count with value 319
[INFO] Collected git.local.branch.ahead with value 0
[INFO] Collected git.local.branch.behind with value 0
[INFO] Collected git.build.time with value 2024-01-04T11:12:41+0100
[INFO] Collected git.build.version with value 0.2.0-SNAPSHOT
[INFO] Collected git.build.host with value Karl-Heinzs-MacBook-Pro.local
[INFO] including property 'git.tags' in results
[INFO] including property 'git.build.version' in results
[INFO] including property 'git.branch' in results
[INFO] including property 'git.build.host' in results
[INFO] including property 'git.commit.user.email' in results
[INFO] including property 'git.local.branch.behind' in results
[INFO] including property 'git.commit.author.time' in results
[INFO] including property 'git.build.user.name' in results
[INFO] including property 'git.dirty' in results
[INFO] including property 'git.closest.tag.commit.count' in results
[INFO] including property 'git.commit.user.name' in results
[INFO] including property 'git.commit.id.abbrev' in results
[INFO] including property 'git.commit.id.describe-short' in results
[INFO] including property 'git.total.commit.count' in results
[INFO] including property 'git.commit.id.describe' in results
[INFO] including property 'git.build.user.email' in results
[INFO] including property 'git.commit.message.short' in results
[INFO] including property 'git.commit.committer.time' in results
[INFO] including property 'git.commit.id.full' in results
[INFO] including property 'git.closest.tag.name' in results
[INFO] including property 'git.local.branch.ahead' in results
[INFO] including property 'git.commit.time' in results
[INFO] including property 'git.build.time' in results
[INFO] including property 'git.commit.message.full' in results
[INFO] including property 'git.remote.origin.url' in results
[INFO] Writing properties file [/Users/khm/xyz/tree/target/classes/git.properties] (for project XYZ..)...
[INFO] 

Is there a (public) project where this issue can be reproduced? (optional)

I used my public project and applied the same configuration and it produces the same warning:

https://github.com/khmarbaise/maven-it-extension/tree/git-commit-id-maven-plugin-issue-687

Your Environment (optional)

Java version: 21.0.1, vendor: Oracle Corporation, runtime: /Users/khm/.sdkman/candidates/java/21.0.1-open Default locale: en_DE, platform encoding: UTF-8 OS name: "mac os x", version: "14.0", arch: "aarch64", family: "mac" also Tested with JDK 17 Java version: 17.0.9, vendor: Eclipse Adoptium, runtime: /Users/khm/.sdkman/candidates/java/17.0.9-tem Default locale: en_DE, platform encoding: UTF-8 OS name: "mac os x", version: "14.0", arch: "aarch64", family: "mac"

Context (optional)

No response

TheSnoozer commented 9 months ago

Hello, thanks for this detailed bug report and the reproducer (also thanks for your contributions to the maven ecosystem) :-)

Unfortunately I'm currently unable to reproduce this issue with the repository provided. I tried various multiple combinations now that would yield the cryptic error in your case:

$ mvn --version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /usr/share/maven-3.8.8
Java version: 21.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-21-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-91-generic", arch: "amd64", family: "unix"

$ mvn --version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /usr/share/maven-3.8.8
Java version: 21.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-21-oracle-x64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-91-generic", arch: "amd64", family: "unix"

$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/share/maven-3.9.6
Java version: 21.0.1, vendor: Private Build, runtime: /usr/lib/jvm/java-21-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-91-generic", arch: "amd64", family: "unix"

$ mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /usr/share/maven-3.9.6
Java version: 21.0.1, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-21-oracle-x64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-91-generic", arch: "amd64", family: "unix"

In general your current configuration uses the jgit-implementation. That is more or less git implemented in java.

When searching the jgit repository: The message templates are defined in:

org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties:commitGraphChunkUnknown=unknown commit-graph chunk: 0x{0}

and the error you observe comes from: https://github.com/eclipse-jgit/jgit/blob/b1cc74b75b771279d81de15833da514c71513648/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphLoader.java#L194.

I can only speculate about the meaning of this error and hence I have created a bug in the jgit repository (https://github.com/eclipse-jgit/jgit/issues/12).

To avoid this issue you could use the native git binary instead of the java git implementation. To enable the native git binary add <useNativeGit>true</useNativeGit> to the plugin configuration.

I hope this helps.