Skip to content

Commit af00855

Browse files
jonathantanmygitster
authored andcommitted
fetch-pack: clear marks before re-marking
If tag following is required when using a transport that does not support tag following, fetch_pack() will be invoked twice in the same process, necessitating a clearing of the object flags used by fetch_pack() sometime during the second invocation. This is currently done in find_common(), which means that the invocation of mark_complete_and_common_ref() in do_fetch_pack() is useless. (This cannot be reproduced with Git alone, because all transports that come with Git support tag following.) Therefore, move this clearing from find_common() to its parent function do_fetch_pack(), right before it calls mark_complete_and_common_ref(). This has been occurring since the commit that introduced the clearing of marks, 420e9af ("Fix tag following", 2008-03-19). The corresponding code for protocol v2 in do_fetch_pack_v2() does not have this problem, as the clearing of flags is done before any marking (whether by rev_list_insert_ref_oid() or mark_complete_and_common_ref()). Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34c2903 commit af00855

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fetch-pack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@ static int find_common(struct fetch_pack_args *args,
336336

337337
if (args->stateless_rpc && multi_ack == 1)
338338
die(_("--stateless-rpc requires multi_ack_detailed"));
339-
if (marked)
340-
for_each_ref(clear_marks, NULL);
341-
marked = 1;
342339

343340
for_each_ref(rev_list_insert_ref_oid, NULL);
344341
for_each_cached_alternate(insert_one_alternate_object);
@@ -1070,6 +1067,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
10701067
if (!server_supports("deepen-relative") && args->deepen_relative)
10711068
die(_("Server does not support --deepen"));
10721069

1070+
if (marked)
1071+
for_each_ref(clear_marks, NULL);
1072+
marked = 1;
10731073
mark_complete_and_common_ref(args, &ref);
10741074
filter_refs(args, &ref, sought, nr_sought);
10751075
if (everything_local(args, &ref)) {

0 commit comments

Comments
 (0)