Skip to content

Error when reading commits for some git repositories #51

@davidfowl

Description

@davidfowl

Repro steps:

  1. clone this project (libgit2) locally
  2. Write the following code:
var r = new Repository(@"C:\dev\github\libgit2sharp\.git");
foreach (var c in r.Commits.ToList()) {
    Console.WriteLine(c);
}

It blows up with:

Unhandled Exception: System.ApplicationException: An error was raised by libgit2
. Error code = GIT_EOBJCORRUPTED (-28).
An error occured
   at LibGit2Sharp.Core.Ensure.Success(Int32 result, Boolean allowPositiveResult
)
   at LibGit2Sharp.Repository.Lookup(ObjectId id, GitObjectType type)
   at LibGit2Sharp.RepositoryExtensions.Lookup[T](Repository repository, ObjectI
d id)
   at LibGit2Sharp.CommitCollection.CommitEnumerator.get_Current()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions