summaryrefslogtreecommitdiff
path: root/t/t5702-protocol-v2.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t5702-protocol-v2.sh')
-rwxr-xr-xt/t5702-protocol-v2.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index e8f0b4a..9113d20 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -212,6 +212,31 @@ test_expect_success 'clone with file:// using protocol v2' '
grep "ref-prefix refs/tags/" log
'
+test_expect_success 'clone of empty repo propagates name of default branch' '
+ test_when_finished "rm -rf file_empty_parent file_empty_child" &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=mydefaultbranch init file_empty_parent &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone "file://$(pwd)/file_empty_parent" file_empty_child &&
+ grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+'
+
+test_expect_success '...but not if explicitly forbidden by config' '
+ test_when_finished "rm -rf file_empty_parent file_empty_child" &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=mydefaultbranch init file_empty_parent &&
+ test_config -C file_empty_parent lsrefs.unborn ignore &&
+
+ GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
+ git -c init.defaultBranch=main -c protocol.version=2 \
+ clone "file://$(pwd)/file_empty_parent" file_empty_child &&
+ ! grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
+'
+
test_expect_success 'fetch with file:// using protocol v2' '
test_when_finished "rm -f log" &&