]> granicus.if.org Git - git/commitdiff
fetch-pack: clear marks before re-marking
authorJonathan Tan <jonathantanmy@google.com>
Wed, 6 Jun 2018 20:47:08 +0000 (13:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Jun 2018 18:31:24 +0000 (11:31 -0700)
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, 420e9af498 ("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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack.c

index 5c87bb8bb80ddc95f8a657df9c5d003b38291b98..2812499a5eca5c7718a5d651ee678e58898cda97 100644 (file)
@@ -336,9 +336,6 @@ static int find_common(struct fetch_pack_args *args,
 
        if (args->stateless_rpc && multi_ack == 1)
                die(_("--stateless-rpc requires multi_ack_detailed"));
-       if (marked)
-               for_each_ref(clear_marks, NULL);
-       marked = 1;
 
        for_each_ref(rev_list_insert_ref_oid, NULL);
        for_each_cached_alternate(insert_one_alternate_object);
@@ -1070,6 +1067,9 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
        if (!server_supports("deepen-relative") && args->deepen_relative)
                die(_("Server does not support --deepen"));
 
+       if (marked)
+               for_each_ref(clear_marks, NULL);
+       marked = 1;
        mark_complete_and_common_ref(args, &ref);
        filter_refs(args, &ref, sought, nr_sought);
        if (everything_local(args, &ref)) {