Skip to content

Commit 26e1afb

Browse files
committed
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 <[email protected]>
1 parent 3642d40 commit 26e1afb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

builtin/pack-objects.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ static int keep_unreachable, unpack_unreachable, include_tag;
209209
static timestamp_t unpack_unreachable_expiration;
210210
static int pack_loose_unreachable;
211211
static int cruft;
212+
static int shallow = 0;
212213
static timestamp_t cruft_expiration;
213214
static int local;
214215
static int have_non_local_packs;
@@ -4483,6 +4484,7 @@ static void get_object_list_path_walk(struct rev_info *revs)
44834484
* base objects.
44844485
*/
44854486
info.prune_all_uninteresting = sparse;
4487+
info.edge_aggressive = shallow;
44864488

44874489
if (walk_objects_by_path(&info))
44884490
die(_("failed to pack objects via path-walk"));
@@ -4684,7 +4686,6 @@ int cmd_pack_objects(int argc,
46844686
struct repository *repo UNUSED)
46854687
{
46864688
int use_internal_rev_list = 0;
4687-
int shallow = 0;
46884689
int all_progress_implied = 0;
46894690
struct strvec rp = STRVEC_INIT;
46904691
int rev_list_unpacked = 0, rev_list_all = 0, rev_list_reflog = 0;
@@ -4872,10 +4873,6 @@ int cmd_pack_objects(int argc,
48724873
warning(_("cannot use delta islands with --path-walk"));
48734874
path_walk = 0;
48744875
}
4875-
if (path_walk && shallow) {
4876-
warning(_("cannot use --shallow with --path-walk"));
4877-
path_walk = 0;
4878-
}
48794876
if (path_walk) {
48804877
strvec_push(&rp, "--boundary");
48814878
/*

0 commit comments

Comments
 (0)