]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sha1-lookup.c
test-tool run-command: learn to run (parts of) the testsuite
[thirdparty/git.git] / sha1-lookup.c
index 796ab68da83c3a36ec87fa45bfa18f5d0508a947..8590aac2544855ffc323ff8722c341c2fc4a9293 100644 (file)
@@ -70,7 +70,7 @@ int sha1_pos(const unsigned char *sha1, void *table, size_t nr,
                        if (miv < lov)
                                return -1;
                        if (hiv < miv)
-                               return -1 - nr;
+                               return index_pos_to_insert_pos(nr);
                        if (lov != hiv) {
                                /*
                                 * At this point miv could be equal
@@ -97,7 +97,7 @@ int sha1_pos(const unsigned char *sha1, void *table, size_t nr,
                        lo = mi + 1;
                mi = lo + (hi - lo) / 2;
        } while (lo < hi);
-       return -lo-1;
+       return index_pos_to_insert_pos(lo);
 }
 
 int bsearch_hash(const unsigned char *sha1, const uint32_t *fanout_nbo,