Skip to content

Commit 448dd8c

Browse files
marcin-krystiancAArnott
authored andcommitted
DeltaStreamReader should interpret 0 size as 0x10000
https://git-scm.com/docs/pack-format/2.31.0#_instruction_to_copy_from_base_object: "In its most compact form, this instruction only takes up one byte (0x80) with both offset and size omitted, which will have default values zero. There is another exception: size zero is automatically converted to 0x10000."
1 parent 4b38f20 commit 448dd8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/NerdBank.GitVersioning/ManagedGit/DeltaStreamReader.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ public static class DeltaStreamReader
8484
{
8585
value.Size |= ((byte)stream.ReadByte() << 16);
8686
}
87+
88+
// Size zero is automatically converted to 0x10000.
89+
if (value.Size == 0)
90+
{
91+
value.Size = 0x10000;
92+
}
8793
}
8894

8995
return value;

0 commit comments

Comments
 (0)