Skip to content

Commit 382a967

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8bee93d commit 382a967

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/fetch-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,8 @@ static void filter_refs(struct ref **refs, struct string_list *sought)
565565
if (cmp < 0) /* definitely do not have it */
566566
break;
567567
else if (cmp == 0) { /* definitely have it */
568-
sought->items[sought_pos].string[0] = '\0';
569568
return_refs[sought_pos] = ref;
569+
sought->items[sought_pos++].string[0] = '\0';
570570
break;
571571
}
572572
else /* might have it; keep looking */

0 commit comments

Comments
 (0)