summaryrefslogtreecommitdiff
path: root/t/t5702-protocol-v2.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-10-03 21:49:17 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-03 21:49:17 -0700
commitac162a606b673e44cec602dfe259aae8e5e08554 (patch)
treeeab7097e463ed367b554a47fe8f173547c33ac8d /t/t5702-protocol-v2.sh
parentMerge branch 'en/stash-df-fix' (diff)
parentclone: handle unborn branch in bare repos (diff)
downloadtgif-ac162a606b673e44cec602dfe259aae8e5e08554.tar.xz
Merge branch 'jk/clone-unborn-head-in-bare'
"git clone" from a repository whose HEAD is unborn into a bare repository didn't follow the branch name the other side used, which is corrected. * jk/clone-unborn-head-in-bare: clone: handle unborn branch in bare repos
Diffstat (limited to 't/t5702-protocol-v2.sh')
-rwxr-xr-xt/t5702-protocol-v2.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index d3687b1a2e..d527cf6c49 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -237,6 +237,19 @@ test_expect_success '...but not if explicitly forbidden by config' '
! grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD
'
+test_expect_success 'bare clone propagates empty default branch' '
+ test_when_finished "rm -rf file_empty_parent file_empty_child.git" &&
+
+ 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 --bare \
+ "file://$(pwd)/file_empty_parent" file_empty_child.git &&
+ grep "refs/heads/mydefaultbranch" file_empty_child.git/HEAD
+'
+
test_expect_success 'fetch with file:// using protocol v2' '
test_when_finished "rm -f log" &&