Once a match has been found at sought_pos, the entry is zeroed and no
future attempts will match that entry. So increment sought_pos to
avoid checking against the zeroed-out entry during the next iteration.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
if (cmp < 0) /* definitely do not have it */
break;
else if (cmp == 0) { /* definitely have it */
- sought->items[sought_pos].string[0] = '\0';
return_refs[sought_pos] = ref;
+ sought->items[sought_pos++].string[0] = '\0';
break;
}
else /* might have it; keep looking */