-
Notifications
You must be signed in to change notification settings - Fork 654
LibGit2Sharp.NotFoundException: Object not found - no match for id #1043
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
Comments
@ryudice: Does this happen in a public repository? If not, can you reproduce it in a public repository we can inspect? Which version of GitVersion are you using? Are you using the MSBuild Task or Usually, this exception occurs if you have a shallow repository or have only cloned a branch and not the whole repository. Does this happen locally or on a build server? |
@asbjornu It seems it was a shallow clone causing the issue, after doing the full clone seems to be ok, maybe a more descriptive error would be good? Thanks for you help. |
@ryudice: I completely agree that a more descriptive error would be good. If you can figure out where we can |
Hi, ERROR [10/21/16 15:44:39:77] An unexpected error occurred:
LibGit2Sharp.NotFoundException: Object not found - no match for id (5a8f976b3c528351cef3d7f632721bfdc785e9c)
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_revwalk_next(RevWalkerHandle walker)
at LibGit2Sharp.CommitLog.CommitEnumerator.MoveNext()
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
at GitVersion.VersionCalculation.FallbackBaseVersionStrategy.<GetVersions>d__0.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersion(GitVersionContext context)
at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion(GitVersionContext context)
at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
at GitVersion.ExecuteCore.<>c__DisplayClass6_0.<ExecuteInternal>b__0(IRepository repo)
at GitVersion.GitPreparer.WithRepository[TResult](Func`2 action)
at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId, Config overrideConfig)
at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)
at GitVersion.Program.VerifyArgumentsAndRun() I git this error while testing the new Shallow clone in VSTS: And then at the end of the script, I got:
I think in case of shallow clone (with an option?) you should ignore this errors |
This seems to be an instance of the same issue: https://travis-ci.org/NUnitSoftware/nunit-gui/jobs/271064871#L2026 I'm in the process of adding GitVersion to the NUnit GUI build. Haven't been able to get it to work on Travis under Linux although the problem doesn't occur on Windows with AppVeyor or locally. Haven't had a chance to try it locally on Linux yet. The failure occurs in the initial call to retrieve a GitVersion instance in my Cake script. |
@CharliePoole: Is Travis doing a shallow clone? If so, does |
@asbjornu Thanks... I found that option and implemented it... works great! It would be better, I think, if GitVersion did something better with that exception. LibGit2Sharp has to throw here, since it doesn't know the purpose of the call. But GitVersion knows what it's doing and could either try to deal with the shallow clone or at least give a better message where that turns out to be the case. |
@CharliePoole: I completely agree, which is why I suggested that solution in #1043 (comment). I've submitted #1287 which should improve the thrown exception. 😃 |
Maybe this fixes the failing builds. ref GitTools/GitVersion#1043 (comment)
Maybe this fixes the failing builds. ref GitTools/GitVersion#1043 (comment)
I'm seeing this is my repo here: https://travis-ci.com/solidclouddev/plivo-dotnet/jobs/162238939 Not sure how to fix this? |
@solidclouddev: It seems like you're using |
Since I couldn't really find the solution to this issue in the documentation, I wanted to mention that, if you are running your project on GitLab CI, you need to set these variables to the job that executes Export GitVersion:
variables:
# Force a deep/non-shallow fetch
GIT_STRATEGY: fetch
GIT_FETCH_EXTRA_FLAGS: --unshallow
GIT_DEPTH: 0 |
I also ran into this issue, and found https://stackoverflow.com/questions/73827375/gitversion-fails-to-get-the-json-data was useful. It did have to do with the shallow fetch, but mine was part of a DevOps pipeline instead of GitLab. |
For Azure DevOps YAML pipelines, this can be fixed by adding |
Any idea why I would get this error and is there anyway to ignore the error? The error is LibGit2Sharp.NotFoundException: Object not found - no match for id
The text was updated successfully, but these errors were encountered: