Git fork
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

pack-objects: allow --shallow and --path-walk

There does not appear to be anything particularly incompatible about the
--shallow and --path-walk options of 'git pack-objects'. If shallow
commits are to be handled differently, then it is by the revision walk
that defines the commit set and which are interesting or uninteresting.

However, before the previous change, a trivial removal of the warning
would cause a failure in t5500-fetch-pack.sh when
GIT_TEST_PACK_PATH_WALK is enabled. The shallow fetch would provide more
objects than we desired, due to some incorrect behavior of the path-walk
API, especially around walking uninteresting objects.

The recently-added tests in t5538-push-shallow.sh help to confirm this
behavior is working with the --path-walk option if
GIT_TEST_PACK_PATH_WALK is enabled. These tests passed previously due to
the --path-walk feature being disabled in the presence of a shallow
clone.

Signed-off-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Derrick Stolee and committed by
Junio C Hamano
c178b02e 4705889c

+11 -4
+2 -3
builtin/pack-objects.c
··· 210 210 static timestamp_t unpack_unreachable_expiration; 211 211 static int pack_loose_unreachable; 212 212 static int cruft; 213 + static int shallow = 0; 213 214 static timestamp_t cruft_expiration; 214 215 static int local; 215 216 static int have_non_local_packs; ··· 4490 4491 * base objects. 4491 4492 */ 4492 4493 info.prune_all_uninteresting = sparse; 4494 + info.edge_aggressive = shallow; 4493 4495 4494 4496 trace2_region_enter("pack-objects", "path-walk", revs->repo); 4495 4497 result = walk_objects_by_path(&info); ··· 4695 4697 struct repository *repo UNUSED) 4696 4698 { 4697 4699 int use_internal_rev_list = 0; 4698 - int shallow = 0; 4699 4700 int all_progress_implied = 0; 4700 4701 struct strvec rp = STRVEC_INIT; 4701 4702 int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0; ··· 4881 4882 option = "--filter"; 4882 4883 else if (use_delta_islands) 4883 4884 option = "--delta-islands"; 4884 - else if (shallow) 4885 - option = "--shallow"; 4886 4885 4887 4886 if (option) { 4888 4887 warning(_("cannot use %s with %s"),
+9 -1
t/t5538-push-shallow.sh
··· 153 153 154 154 # If the delta base is found, then this message uses "bytes". 155 155 # If the delta base is not found, then this message uses "KiB". 156 - test_grep "Writing objects: .* bytes" err 156 + test_grep "Writing objects: .* bytes" err && 157 + 158 + git -C deltas commit --amend -m "changed message" && 159 + GIT_TRACE2_EVENT="$(pwd)/config-push.txt" \ 160 + GIT_PROGRESS_DELAY=0 git -C deltas -c pack.usePathWalk=true \ 161 + push --progress -f origin deltas 2>err && 162 + 163 + test_grep "Enumerating objects: 1, done" err && 164 + test_region pack-objects path-walk config-push.txt 157 165 ' 158 166 159 167 test_done