Skip to content

Commit 14f49b2

Browse files
committed
Merge branch 'xl/record-partial-clone-origin'
When creating a partial clone, the object filtering criteria is recorded for the origin of the clone, but this incorrectly used a hardcoded name "origin" to name that remote; it has been corrected to honor the "--origin <name>" option. * xl/record-partial-clone-origin: clone: respect user supplied origin name when setting up partial clone
2 parents dedc046 + 1c4a9f9 commit 14f49b2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
12271227
remote_head_points_at, &branch_top);
12281228

12291229
if (filter_options.choice)
1230-
partial_clone_register("origin", &filter_options);
1230+
partial_clone_register(option_origin, &filter_options);
12311231

12321232
if (is_local)
12331233
clone_local(path, git_dir);

t/t5601-clone.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,8 @@ test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
630630
test_i18ngrep "the following paths have collided" icasefs/warning
631631
'
632632

633-
partial_clone () {
633+
partial_clone_server () {
634634
SERVER="$1" &&
635-
URL="$2" &&
636635

637636
rm -rf "$SERVER" client &&
638637
test_create_repo "$SERVER" &&
@@ -642,8 +641,14 @@ partial_clone () {
642641
test_commit -C "$SERVER" two &&
643642
HASH2=$(git hash-object "$SERVER/two.t") &&
644643
test_config -C "$SERVER" uploadpack.allowfilter 1 &&
645-
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
644+
test_config -C "$SERVER" uploadpack.allowanysha1inwant 1
645+
}
646646

647+
partial_clone () {
648+
SERVER="$1" &&
649+
URL="$2" &&
650+
651+
partial_clone_server "${SERVER}" &&
647652
git clone --filter=blob:limit=0 "$URL" client &&
648653

649654
git -C client fsck &&
@@ -660,6 +665,11 @@ test_expect_success 'partial clone' '
660665
partial_clone server "file://$(pwd)/server"
661666
'
662667

668+
test_expect_success 'partial clone with -o' '
669+
partial_clone_server server &&
670+
git clone -o blah --filter=blob:limit=0 "file://$(pwd)/server" client
671+
'
672+
663673
test_expect_success 'partial clone: warn if server does not support object filtering' '
664674
rm -rf server client &&
665675
test_create_repo server &&

0 commit comments

Comments
 (0)