aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/idxfile/decoder.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-27 09:35:19 +0200
committerGitHub <noreply@github.com>2017-07-27 09:35:19 +0200
commit854ffa16f650706200a6ebb5505bb448b5c64035 (patch)
tree61892f335f61c6fbb2bf65f7daf51829276a8e28 /plumbing/format/idxfile/decoder.go
parentc2561364e33763d3356a23c5850424a334de30e9 (diff)
parent48900a1c810dd2dac9cb44511e6a2412d3064da6 (diff)
downloadgo-git-854ffa16f650706200a6ebb5505bb448b5c64035.tar.gz
Merge pull request #512 from mcuadros/idx-64bits
format: idxfile, support for >2Gb packfiles
Diffstat (limited to 'plumbing/format/idxfile/decoder.go')
-rw-r--r--plumbing/format/idxfile/decoder.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/plumbing/format/idxfile/decoder.go b/plumbing/format/idxfile/decoder.go
index 4243f76..f361213 100644
--- a/plumbing/format/idxfile/decoder.go
+++ b/plumbing/format/idxfile/decoder.go
@@ -123,6 +123,7 @@ func readCRC32(idx *Idxfile, r io.Reader) error {
func readOffsets(idx *Idxfile, r io.Reader) error {
c := int(idx.ObjectCount)
+
for i := 0; i < c; i++ {
o, err := binary.ReadUint32(r)
if err != nil {
@@ -132,6 +133,19 @@ func readOffsets(idx *Idxfile, r io.Reader) error {
idx.Entries[i].Offset = uint64(o)
}
+ for i := 0; i < c; i++ {
+ if idx.Entries[i].Offset <= offsetLimit {
+ continue
+ }
+
+ o, err := binary.ReadUint64(r)
+ if err != nil {
+ return err
+ }
+
+ idx.Entries[i].Offset = o
+ }
+
return nil
}