libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.21k stars 889 forks source link

Error when fetching from remote LibGit2Sharp.NotFoundException: 'object not found - no match for id #1828

Open cortex-pg opened 4 years ago

cortex-pg commented 4 years ago

We have been having a problem with libgit2sharp being unable to fetch from a remote after it gets to a certain size/certain number of branches. Researching this error seems to come back with results of problems with a sparse checkout which this isn't doing. I have attached a example program and repository that reproduces it. If you go to the generated repository user in the bin folder after running the program and run git pull from the command line it completes successfully.

Reproduction steps

Run the program downloadable here. I don't know exactly what it is about the repository that causes the problem.

Expected behavior

The fetch works as normal

Actual behavior

LibGit2Sharp.NotFoundException: 'object not found - no match for id (073a4772601e16614079cff44ca8d7d6275f6377)' is thrown

Version of LibGit2Sharp (release number or SHA1)

v0.26.2

Operating system(s) tested; .NET runtime tested

.NET Core SDK (reflecting any global.json): Version: 3.1.401 Commit: 5b6f5e5005

Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64

acn-sbuad commented 4 years ago

We are experiencing the same error message when calling repo.Pull.

Runtime Environment: 3.1.7 (image dotnet/core/aspnet:3.1.7-alpine3.12) .NET Core SDK (reflecting any global.json): Version: 3.1.401 LibGit2Sharp Version="0.27.0-preview-0034

elzik commented 1 year ago

I have the same issue. It works fine locally on my own Windows machine but when I run on an Azure pipeline hosted agent (ubuntu-22.04) it fails with the same LibGit2Sharp.NotFoundException: 'object not found - no match for id.

I have LibGit2Sharp v0.27.2 and my application is .NET 7.

ethomson commented 1 year ago

I have the same issue. It works fine locally on my own Windows machine but when I run on an Azure pipeline hosted agent (ubuntu-22.04) it fails with the same LibGit2Sharp.NotFoundException: 'object not found - no match for id.

@elzik Azure Pipelines does a shallow clone by default. Be sure to configure it to do a deep(er) clone.

elzik commented 1 year ago

@ethomson

@elzik Azure Pipelines does a shallow clone by default. Be sure to configure it to do a deep(er) clone.

Thanks, that was it. The error was happening when I was trying to find the most recent tag so I was using:

repo.Describe(currentCommit, new DescribeOptions() { Strategy = DescribeStrategy.Tags })

However, I'd still like to get the most recent tag even with a shallow clone. Is this simply not possible?