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>maint
parent
4705889c3d
commit
c178b02e29
|
|
@ -210,6 +210,7 @@ static int keep_unreachable, unpack_unreachable, include_tag;
|
|||
static timestamp_t unpack_unreachable_expiration;
|
||||
static int pack_loose_unreachable;
|
||||
static int cruft;
|
||||
static int shallow = 0;
|
||||
static timestamp_t cruft_expiration;
|
||||
static int local;
|
||||
static int have_non_local_packs;
|
||||
|
|
@ -4490,6 +4491,7 @@ static void get_object_list_path_walk(struct rev_info *revs)
|
|||
* base objects.
|
||||
*/
|
||||
info.prune_all_uninteresting = sparse;
|
||||
info.edge_aggressive = shallow;
|
||||
|
||||
trace2_region_enter("pack-objects", "path-walk", revs->repo);
|
||||
result = walk_objects_by_path(&info);
|
||||
|
|
@ -4695,7 +4697,6 @@ int cmd_pack_objects(int argc,
|
|||
struct repository *repo UNUSED)
|
||||
{
|
||||
int use_internal_rev_list = 0;
|
||||
int shallow = 0;
|
||||
int all_progress_implied = 0;
|
||||
struct strvec rp = STRVEC_INIT;
|
||||
int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0;
|
||||
|
|
@ -4881,8 +4882,6 @@ int cmd_pack_objects(int argc,
|
|||
option = "--filter";
|
||||
else if (use_delta_islands)
|
||||
option = "--delta-islands";
|
||||
else if (shallow)
|
||||
option = "--shallow";
|
||||
|
||||
if (option) {
|
||||
warning(_("cannot use %s with %s"),
|
||||
|
|
|
|||
|
|
@ -153,7 +153,15 @@ test_expect_success 'push new commit from shallow clone has good deltas' '
|
|||
|
||||
# If the delta base is found, then this message uses "bytes".
|
||||
# If the delta base is not found, then this message uses "KiB".
|
||||
test_grep "Writing objects: .* bytes" err
|
||||
test_grep "Writing objects: .* bytes" err &&
|
||||
|
||||
git -C deltas commit --amend -m "changed message" &&
|
||||
GIT_TRACE2_EVENT="$(pwd)/config-push.txt" \
|
||||
GIT_PROGRESS_DELAY=0 git -C deltas -c pack.usePathWalk=true \
|
||||
push --progress -f origin deltas 2>err &&
|
||||
|
||||
test_grep "Enumerating objects: 1, done" err &&
|
||||
test_region pack-objects path-walk config-push.txt
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
|||
Loading…
Reference in New Issue