Skip to content

Commit f14d04f

Browse files
calvin-wan-googlegitster
authored andcommitted
fetch-pack: move fetch initialization
There are some variables initialized at the start of the do_fetch_pack_v2() state machine. Currently, they are initialized in FETCH_CHECK_LOCAL, which is the initial state set at the beginning of the function. However, a subsequent patch will allow for another initial state, while still requiring these initialized variables. Move the initialization to be before the state machine, so that they are set regardless of the initial state. Note that there is no change in behavior, because we're moving code from the beginning of the first state to just before the execution of the state machine. Helped-by: Jonathan Tan <jonathantanmy@google.com> Helped-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Calvin Wan <calvinwan@google.com> Signed-off-by: Eric Ju <eric.peijian@gmail.com> Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent dc9fe81 commit f14d04f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

fetch-pack.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,18 +1735,18 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
17351735
reader.me = "fetch-pack";
17361736
}
17371737

1738+
/* v2 supports these by default */
1739+
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
1740+
use_sideband = 2;
1741+
if (args->depth > 0 || args->deepen_since || args->deepen_not)
1742+
args->deepen = 1;
1743+
17381744
while (state != FETCH_DONE) {
17391745
switch (state) {
17401746
case FETCH_CHECK_LOCAL:
17411747
sort_ref_list(&ref, ref_compare_name);
17421748
QSORT(sought, nr_sought, cmp_ref_by_name);
17431749

1744-
/* v2 supports these by default */
1745-
allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
1746-
use_sideband = 2;
1747-
if (args->depth > 0 || args->deepen_since || args->deepen_not)
1748-
args->deepen = 1;
1749-
17501750
/* Filter 'ref' by 'sought' and those that aren't local */
17511751
mark_complete_and_common_ref(negotiator, args, &ref);
17521752
filter_refs(args, &ref, sought, nr_sought);

0 commit comments

Comments
 (0)