Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
Populate the offsetToType cache in the iterator even for the skipped …
Browse files Browse the repository at this point in the history
…objects

Signed-off-by: Filip Navara <navara@emclient.com>
  • Loading branch information
filipnavara committed Apr 24, 2019
1 parent b0e21ee commit f25873b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plumbing/format/packfile/packfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,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)
Expand Down

0 comments on commit f25873b

Please sign in to comment.