From: mhagger@alum.mit.edu Date: Thu, 23 Aug 2012 08:10:30 GMT Subject: [PATCH 05/17] Do not check the same match_pos twice Message-ID: <1345709442-16046-6-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1345709442-16046-1-git-send-email-mhagger@alum.mit.edu> From: Michael Haggerty Once a match has been found at match_pos, the entry is zeroed and no future attempts will match that entry. So increment match_pos to avoid checking against the zeroed-out entry during the next iteration. Signed-off-by: Michael Haggerty --- builtin/fetch-pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index f11545e..a6406e7 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -561,8 +561,8 @@ static void filter_refs(struct ref **refs, int nr_heads, char **heads) if (cmp < 0) /* definitely do not have it */ break; else if (cmp == 0) { /* definitely have it */ - heads[match_pos][0] = '\0'; return_refs[match_pos] = ref; + heads[match_pos++][0] = '\0'; break; } else /* might have it; keep looking */ -- 1.7.11.3