summaryrefslogtreecommitdiff
path: root/t/t0001-init.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index f593c53687..618da080dc 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -883,6 +883,22 @@ test_expect_success 'advice on unconfigured init.defaultBranch disabled' '
test_grep ! "hint: " err
'
+test_expect_success 'default branch name' '
+ if test_have_prereq WITH_BREAKING_CHANGES
+ then
+ expect=main
+ else
+ expect=master
+ fi &&
+ echo "refs/heads/$expect" >expect &&
+ (
+ sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME &&
+ git init default-initial-branch-name
+ ) &&
+ git -C default-initial-branch-name symbolic-ref HEAD >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'overridden default main branch name (env)' '
test_config_global init.defaultBranch nmb &&
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env &&