aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorFilip Navara <navara@emclient.com>2019-04-24 09:21:19 +0200
committerFilip Navara <navara@emclient.com>2019-04-24 09:22:04 +0200
commit3237897858a3a35247e7016c90cb8e906b4cd3d2 (patch)
treeb16bf39b36e34cb021fb91a8813fbcf168699c2b /plumbing
parentb649682ff0b1b5141120a391a21b881bd1efa32b (diff)
downloadgo-git-3237897858a3a35247e7016c90cb8e906b4cd3d2.tar.gz
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>
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/format/packfile/packfile.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/plumbing/format/packfile/packfile.go b/plumbing/format/packfile/packfile.go
index 52eb338..0dd9730 100644
--- a/plumbing/format/packfile/packfile.go
+++ b/plumbing/format/packfile/packfile.go
@@ -500,15 +500,19 @@ func (i *objectIter) Next() (plumbing.EncodedObject, error) {
return nil, err
}
- typ, err := i.p.getObjectType(h)
- if err != nil {
- return nil, err
- }
- if typ != i.typ {
- continue
+ if h.Type == plumbing.REFDeltaObject || h.Type == plumbing.OFSDeltaObject {
+ obj, err := i.p.getNextObject(h, e.Hash)
+ if err != nil {
+ return nil, err
+ }
+ if obj.Type() == i.typ {
+ return obj, nil
+ }
+ } else if h.Type == i.typ {
+ return i.p.getNextObject(h, e.Hash)
}
- return i.p.getNextObject(h, e.Hash)
+ continue
}
}