aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Navara <navara@emclient.com>2019-04-24 09:42:53 +0200
committerFilip Navara <navara@emclient.com>2019-04-24 09:43:37 +0200
commit78bab69f9cb3d93b256f13e8b73f223f39d3d670 (patch)
tree2fe68b7f22b4a0035049ed28b6e16944a9f6388a
parentb0e21ee09bde46ab5002c04680885890390d3cf7 (diff)
downloadgo-git-78bab69f9cb3d93b256f13e8b73f223f39d3d670.tar.gz
Populate the offsetToType cache in the iterator even for the skipped objects
Signed-off-by: Filip Navara <navara@emclient.com>
-rw-r--r--plumbing/format/packfile/packfile.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/plumbing/format/packfile/packfile.go b/plumbing/format/packfile/packfile.go
index a8f3d2b..def6e99 100644
--- a/plumbing/format/packfile/packfile.go
+++ b/plumbing/format/packfile/packfile.go
@@ -478,6 +478,7 @@ func (i *objectIter) Next() (plumbing.EncodedObject, error) {
}
} else if obj, ok := i.p.cacheGet(e.Hash); ok {
if obj.Type() != i.typ {
+ i.p.offsetToType[int64(e.Offset)] = obj.Type()
continue
}
return obj, nil
@@ -493,12 +494,14 @@ func (i *objectIter) Next() (plumbing.EncodedObject, error) {
return nil, err
}
if typ != i.typ {
+ i.p.offsetToType[int64(e.Offset)] = typ
continue
}
// getObjectType will seek in the file so we cannot use getNextObject safely
return i.p.objectAtOffset(int64(e.Offset), e.Hash)
} else {
if h.Type != i.typ {
+ i.p.offsetToType[int64(e.Offset)] = h.Type
continue
}
return i.p.getNextObject(h, e.Hash)