Skip to content

Commit

Permalink
filter_refs(): do not check the same sought_pos twice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Sep 12, 2012
1 parent 8bee93d commit 382a967
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ static void filter_refs(struct ref **refs, struct string_list *sought)
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 */
Expand Down

0 comments on commit 382a967

Please sign in to comment.