diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-07-26 14:19:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 14:19:32 +0200 |
commit | a08061aa298ec4b92bbe470a1834465f25a0ad0d (patch) | |
tree | 8804820221e05096433b2e0cef5249e4a3e94c7b /plumbing/format/packfile/decoder.go | |
parent | a8ff3e599b3ee998a8b8626cd9fe9fa68490d354 (diff) | |
parent | 79f249465b24104b73c9dc220d9098cecdab4d77 (diff) | |
download | go-git-a08061aa298ec4b92bbe470a1834465f25a0ad0d.tar.gz |
Merge pull request #898 from jfontan/feature/new-packfile-parser
Feature/new packfile parser
Diffstat (limited to 'plumbing/format/packfile/decoder.go')
-rw-r--r-- | plumbing/format/packfile/decoder.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plumbing/format/packfile/decoder.go b/plumbing/format/packfile/decoder.go index 765401f..69aef2d 100644 --- a/plumbing/format/packfile/decoder.go +++ b/plumbing/format/packfile/decoder.go @@ -403,12 +403,13 @@ func (d *Decoder) fillOFSDeltaObjectContent(obj plumbing.EncodedObject, offset i return 0, err } - e, ok := d.idx.LookupOffset(uint64(offset)) - var base plumbing.EncodedObject - if ok { - base, ok = d.cacheGet(e.Hash) - } + // e, ok := d.idx.LookupOffset(uint64(offset)) + // if ok { + // base, ok = d.cacheGet(e.Hash) + // } + var base plumbing.EncodedObject + ok := false if !ok { base, err = d.recallByOffset(offset) if err != nil { @@ -446,11 +447,12 @@ func (d *Decoder) recallByOffset(o int64) (plumbing.EncodedObject, error) { return d.DecodeObjectAt(o) } - if e, ok := d.idx.LookupOffset(uint64(o)); ok { - return d.recallByHashNonSeekable(e.Hash) + hash, err := d.idx.FindHash(o) + if err != nil { + return nil, err } - return nil, plumbing.ErrObjectNotFound + return d.recallByHashNonSeekable(hash) } func (d *Decoder) recallByHash(h plumbing.Hash) (plumbing.EncodedObject, error) { |