Skip to content

Commit

Permalink
DeltaStreamReader should interpret 0 size as 0x10000
Browse files Browse the repository at this point in the history
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."
  • Loading branch information
marcin-krystianc authored and AArnott committed Sep 20, 2022
1 parent 4b38f20 commit 448dd8c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/NerdBank.GitVersioning/ManagedGit/DeltaStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public static class DeltaStreamReader
{
value.Size |= ((byte)stream.ReadByte() << 16);
}

// Size zero is automatically converted to 0x10000.
if (value.Size == 0)
{
value.Size = 0x10000;
}
}

return value;
Expand Down

0 comments on commit 448dd8c

Please sign in to comment.