Merge branch 'sg/ci-brew-gcc-workaround'
[gitweb.git] / read-cache.c
index 4dd22f4f6eb60ffa8f7c31a535a14b16fb403e53..c701f7f8b81378104e2732e8bb132144ff82e8f5 100644 (file)
@@ -549,7 +549,7 @@ static int index_name_stage_pos(const struct index_state *istate, const char *na
        first = 0;
        last = istate->cache_nr;
        while (last > first) {
-               int next = (last + first) >> 1;
+               int next = first + ((last - first) >> 1);
                struct cache_entry *ce = istate->cache[next];
                int cmp = cache_name_stage_compare(name, namelen, stage, ce->name, ce_namelen(ce), ce_stage(ce));
                if (!cmp)