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

Commit 3237897

Browse files
committed
Fix an error where getObjectType would seek in file and mess up the position used by getNextObject in the subsequent statement
Signed-off-by: Filip Navara <navara@emclient.com>
1 parent b649682 commit 3237897

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

plumbing/format/packfile/packfile.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,19 @@ func (i *objectIter) Next() (plumbing.EncodedObject, error) {
500500
return nil, err
501501
}
502502

503-
typ, err := i.p.getObjectType(h)
504-
if err != nil {
505-
return nil, err
506-
}
507-
if typ != i.typ {
508-
continue
503+
if h.Type == plumbing.REFDeltaObject || h.Type == plumbing.OFSDeltaObject {
504+
obj, err := i.p.getNextObject(h, e.Hash)
505+
if err != nil {
506+
return nil, err
507+
}
508+
if obj.Type() == i.typ {
509+
return obj, nil
510+
}
511+
} else if h.Type == i.typ {
512+
return i.p.getNextObject(h, e.Hash)
509513
}
510514

511-
return i.p.getNextObject(h, e.Hash)
515+
continue
512516
}
513517
}
514518

0 commit comments

Comments
 (0)