diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-07-26 12:24:26 +0200 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2018-07-26 14:17:56 +0200 |
commit | 7418b411660aaa3d8d54eb602fda8accaed2833f (patch) | |
tree | 5f1bcba54814c30d74a29af8477e2e08cf83b5ca /plumbing/format/idxfile | |
parent | a716126aa7f9b77030d2e697db24d206d944f05d (diff) | |
download | go-git-7418b411660aaa3d8d54eb602fda8accaed2833f.tar.gz |
plumbing/idxfile: fix bug searching in MemoryIndex
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing/format/idxfile')
-rw-r--r-- | plumbing/format/idxfile/idxfile.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/format/idxfile/idxfile.go b/plumbing/format/idxfile/idxfile.go index b196608..adeba44 100644 --- a/plumbing/format/idxfile/idxfile.go +++ b/plumbing/format/idxfile/idxfile.go @@ -72,7 +72,7 @@ func (idx *MemoryIndex) findHashIndex(h plumbing.Hash) int { low := uint64(0) for { mid := (low + high) >> 1 - offset := mid + (mid << 2) + offset := mid * objectIDLength cmp := bytes.Compare(h[:], data[offset:offset+objectIDLength]) if cmp < 0 { @@ -83,7 +83,7 @@ func (idx *MemoryIndex) findHashIndex(h plumbing.Hash) int { low = mid + 1 } - if low < high { + if low > high { break } } |