push: test to verify that push errors are colored
[gitweb.git] / string-list.c
index 806b4c87232fb2ed307f6ce64817e14feefc216f..a0cf0cfe88ee38f35ec33662778ec1bd7036a127 100644 (file)
@@ -16,7 +16,7 @@ static int get_entry_index(const struct string_list *list, const char *string,
        compare_strings_fn cmp = list->cmp ? list->cmp : strcmp;
 
        while (left + 1 < right) {
-               int middle = (left + right) / 2;
+               int middle = left + (right - left) / 2;
                int compare = cmp(string, list->items[middle].string);
                if (compare < 0)
                        right = middle;