filter_refs(): do not check the same sought_pos twice

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>

Michael Haggerty committed Sep 9, 2012 at 08:19 UTC 382a96711470489ea6e4e277accd3afc46526bfc
1 file changed +1 -1
builtin/fetch-pack.c
+1 -1
@@ -565,8 +565,8 @@ static void filter_refs(struct ref **refs, struct string_list *sought)
565 if (cmp < 0) /* definitely do not have it */
566 break;
567 else if (cmp == 0) { /* definitely have it */
568 - sought->items[sought_pos].string[0] = '\0';
568 return_refs[sought_pos] = ref;
569 + sought->items[sought_pos++].string[0] = '\0';
570 break;
571 }
572 else /* might have it; keep looking */