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
Fix bugs with > 2 GB pack files #634
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ public static Stream GetObject(GitPack pack, Stream stream, long offset, string | |
if (type == GitPackObjectType.OBJ_OFS_DELTA) | ||
{ | ||
var baseObjectRelativeOffset = ReadVariableLengthInteger(stream); | ||
var baseObjectOffset = (int)(offset - baseObjectRelativeOffset); | ||
var baseObjectOffset = offset - baseObjectRelativeOffset; | ||
filipnavara marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
var deltaStream = new ZLibStream(stream, decompressedSize); | ||
var baseObjectStream = pack.GetObject(baseObjectOffset, objectType); | ||
|
@@ -98,9 +98,9 @@ private static (GitPackObjectType, long) ReadObjectHeader(Stream stream) | |
return (type, length); | ||
} | ||
|
||
private static int ReadVariableLengthInteger(Stream stream) | ||
private static long ReadVariableLengthInteger(Stream stream) | ||
{ | ||
int offset = -1; | ||
long offset = -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ref: https://git-scm.com/docs/pack-format
Example: Base offset is |
||
int b; | ||
|
||
do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref: https://github.com/go-git/go-git/blob/master/plumbing/format/idxfile/idxfile.go#L146
Ref: https://git-scm.com/docs/pack-format