From: Michael Haggerty Date: Sun, 9 Sep 2012 06:19:41 +0000 (+0200) Subject: filter_refs(): do not check the same sought_pos twice X-Git-Tag: v1.8.0-rc0~30^2~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=382a96711470489ea6e4e277accd3afc46526bfc;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index df81995ea..63d455ffe 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -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 */