aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-07-26 19:28:34 +0200
committerJavi Fontan <jfontan@gmail.com>2018-07-26 19:28:34 +0200
commit4b366ac48de72f63905c6e92e387677e83e97d5c (patch)
tree1c8443726b19bb88822423434f5ee6c4f222dc76
parentbc565c1ba0516677d9227e19de544a9126db0a55 (diff)
downloadgo-git-4b366ac48de72f63905c6e92e387677e83e97d5c.tar.gz
plumbing: fix two errors in idxfile and packfile decoder
Signed-off-by: Javi Fontan <jfontan@gmail.com>
-rw-r--r--plumbing/format/idxfile/idxfile.go2
-rw-r--r--plumbing/format/packfile/decoder.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/format/idxfile/idxfile.go b/plumbing/format/idxfile/idxfile.go
index f8debb1..f57df2e 100644
--- a/plumbing/format/idxfile/idxfile.go
+++ b/plumbing/format/idxfile/idxfile.go
@@ -87,7 +87,7 @@ func (idx *MemoryIndex) findHashIndex(h plumbing.Hash) int {
low = mid + 1
}
- if low > high {
+ if low >= high {
break
}
}
diff --git a/plumbing/format/packfile/decoder.go b/plumbing/format/packfile/decoder.go
index 69aef2d..87c347f 100644
--- a/plumbing/format/packfile/decoder.go
+++ b/plumbing/format/packfile/decoder.go
@@ -457,7 +457,7 @@ func (d *Decoder) recallByOffset(o int64) (plumbing.EncodedObject, error) {
func (d *Decoder) recallByHash(h plumbing.Hash) (plumbing.EncodedObject, error) {
if d.s.IsSeekable {
- if offset, err := d.idx.FindOffset(h); err != nil {
+ if offset, err := d.idx.FindOffset(h); err == nil {
return d.DecodeObjectAt(offset)
}
}