clone: respect user supplied origin name when setting up partial clone
Signed-off-by: Xin Li <delphij@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Xin Li committed
May 29, 2019 at 14:26 UTC
1c4a9f91142b2ca1b715e99b6e6da4016d422eb4
2 files changed
+14
-4
builtin/clone.c
+1
-1
@@ -1220,7 +1220,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
1220
remote_head_points_at, &branch_top);
1221
1222
if (filter_options.choice)
1223
- partial_clone_register("origin", &filter_options);
1223
+ partial_clone_register(option_origin, &filter_options);
1224
1225
if (is_local)
1226
clone_local(path, git_dir);
t/t5601-clone.sh
+13
-3
@@ -630,9 +630,8 @@ test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
630
test_i18ngrep "the following paths have collided" icasefs/warning
631
'
632
633
-partial_clone () {
633
+partial_clone_server () {
634
SERVER="$1" &&
635
- URL="$2" &&
635
636
rm -rf "$SERVER" client &&
637
test_create_repo "$SERVER" &&
@@ -642,8 +641,14 @@ partial_clone () {
641
test_commit -C "$SERVER" two &&
642
HASH2=$(git hash-object "$SERVER/two.t") &&
643
test_config -C "$SERVER" uploadpack.allowfilter 1 &&
645
- test_config -C "$SERVER" uploadpack.allowanysha1inwant 1 &&
644
+ test_config -C "$SERVER" uploadpack.allowanysha1inwant 1
645
+}
646
647
+partial_clone () {
648
+ SERVER="$1" &&
649
+ URL="$2" &&
650
+
651
+ partial_clone_server "${SERVER}" &&
652
git clone --filter=blob:limit=0 "$URL" client &&
653
654
git -C client fsck &&
@@ -660,6 +665,11 @@ test_expect_success 'partial clone' '
665
partial_clone server "file://$(pwd)/server"
666
'
667
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
+
673
test_expect_success 'partial clone: warn if server does not support object filtering' '
674
rm -rf server client &&
675
test_create_repo server &&