libgit2 / libgit2/libgit2sharp

Failing to read huge pack files

Open
#1,835 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

I'm using lib2gitsharp with big enterprise repositories which may have pack files with a size of 4 to 5 GB. When the size of the initially cloned pack file exceeds a certain value, reading operations will fail. I started with a 4.5 GB pack file repo, which I updated incrementally for some months. This poses no problems. When I freshly clone the same repo now, the initial pack file has (due to ongoing development) grown to 5.5 GB, which lib2gitsharp cannot handle any more.

Reproduction steps

Connect to a repository with pack files of size between 4.5 GB (working) and 5.56 GB (failing).
Iterate the commits of a branch or call a Diff.Compare on two Trees.

Expected behavior

Iterating the commit collection or comparing two trees works without exception.

Actual behavior

A LibGit2SharpException exception is thrown:

LibGit2Sharp.LibGit2SharpException
HResult=0x80131500
Message=invalid pack file - delta offset is zero
Source=LibGit2Sharp
StackTrace:
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 154

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Win 10, .NET Framework 4.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with a repository containing a 5.56 GB pack file, then inspect the exception path at LibGit2Sharp/Core/Ensure.cs:154. Compare commit iteration and Diff.Compare behavior with the 4.5 GB working case; done means both operations complete without the invalid pack file exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.