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

Can't "calculate distance" #550

Open
Randgalt opened this issue Mar 21, 2021 · 5 comments
Open

Can't "calculate distance" #550

Randgalt opened this issue Mar 21, 2021 · 5 comments
Labels

Comments

@Randgalt
Copy link

Describe the bug

Using the Maven plugin under Java 16 produces:

[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:4.0.0:revision (default) on project missioncontrol-ui: Could not complete Mojo execution...: Unable to calculate distance between [commit f976ff5a182d64ad40c3fddd5a26c52a01c35b87 1615476615 ----sp] and [commit 88c9bb3a19a570c30f2e55ab7f9a74d2647ef221 1615471284 ----sp]: Missing commit 8cb5a9485154c19fc4eb6866653394f34bbf6f5d -> [Help 1]

Steps to Reproduce

            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>4.0.4</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                    <includeOnlyProperties>
                        <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
                        <includeOnlyProperty>^git.branch$</includeOnlyProperty>
                        <includeOnlyProperty>^git.tags$</includeOnlyProperty>
                    </includeOnlyProperties>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                </configuration>
            </plugin>
@TheSnoozer
Copy link
Collaborator

Hi,
thanks for reporting your problem! Just curious:

  • Have you tested the issue occurs with other java versions too? E.g. java 12? For me this sounds unrelated to the java version used.
  • Are you operating on a shallow clone? Or rebased recently?
  • Does the problem still exists when running the plugin with the native git binary? E.g. by adding <useNativeGit>false</useNativeGit> to the configuration section?

@roman-svystun
Copy link

Today I got this error for the first time in 3 years.

[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:3.0.1:revision (get-the-git-infos) on project integration-test-base: Could not complete Mojo execution...: Unable to calculate distance between [commit 588c76345f1fffc5d159cfe90a22cca5ceb162cc 1627017891 ----sp] and [commit 8f67ef47a6d465675f4559306bfa25d3530069a0 1626458946 ----sp]: Missing commit 14c7b7588854455277cc09839911a22ea96851cd

The commit 14c7b7588854455277cc09839911a22ea96851cd is a 4 month old commit that is definitely present - I can checkout a new branch from it.

Java 11, git-commit-id-plugin v 2.2.6 and 3.0.1.

With <useNativeGit>false</useNativeGit> it fails with the same error.

With <useNativeGit>true</useNativeGit> it all works without an issue.

My machine has git version 2.32.0.

@TheSnoozer TheSnoozer changed the title Under Java 16 can't "calculate distance" Can't "calculate distance" Jul 27, 2021
@TheSnoozer
Copy link
Collaborator

Hi,
thanks for the follow-up and sorry that the JGit Implementation breaks.
Are you perhaps performing a shallow clone?
I rephrased the name of the ticket, since it's not a Java 16 issue...it's a general issue with the plugin.

@roman-svystun
Copy link

It's not a shallow clone.

The system that has this issue also has git maintenance running regularly.

0 1-23 * * * "/usr/lib/git-core/git" --exec-path="/usr/lib/git-core" for-each-repo --config=maintenance.repo maintenance run --schedule=hourly
0 0 * * 1-6 "/usr/lib/git-core/git" --exec-path="/usr/lib/git-core" for-each-repo --config=maintenance.repo maintenance run --schedule=daily
0 0 * * 0 "/usr/lib/git-core/git" --exec-path="/usr/lib/git-core" for-each-repo --config=maintenance.repo maintenance run --schedule=weekly

https://git-scm.com/docs/git-maintenance

I think this maintenance has overly compacted something and now JGit fails.

On another system without git maintenance there is no issue.
Also if I do a fresh clone - again there is no issue.

@TheSnoozer
Copy link
Collaborator

Interesting. Thanks for the update. It seems that a while back we also had this issue appearing in the wild (#63). However it seems that "we" never really understood it's root cause.
Let me keep this open and explore it when I have more free time again :-)

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

No branches or pull requests

3 participants