Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Goodman-Wilson <don@goodman-wilson.com>2020-06-24 17:46:33 +0300
committerJunio C Hamano <gitster@pobox.com>2020-06-24 19:14:21 +0300
commit8747ebb7cde9e90d20794c06e6806f75cd540142 (patch)
tree2dedd0e043802202071b7490c1ba1a97ac03ad88 /t/t0001-init.sh
parent32ba12dab2acf1ad11836a627956d1473f6b851a (diff)
init: allow setting the default for the initial branch name via the config
We just introduced the command-line option `--initial-branch=<branch-name>` to allow initializing a new repository with a different initial branch than the hard-coded one. To allow users to override the initial branch name more permanently (i.e. without having to specify the name manually for each and every `git init` invocation), let's introduce the `init.defaultBranch` config setting. Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Helped-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Don Goodman-Wilson <don@goodman-wilson.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0001-init.sh')
-rwxr-xr-xt/t0001-init.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 386c06b5dd..6d2467995e 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -477,4 +477,17 @@ test_expect_success '--initial-branch' '
grep hello actual
'
+test_expect_success 'overridden default initial branch name (config)' '
+ test_config_global init.defaultBranch nmb &&
+ git init initial-branch-config &&
+ git -C initial-branch-config symbolic-ref HEAD >actual &&
+ grep nmb actual
+'
+
+test_expect_success 'invalid default branch name' '
+ test_config_global init.defaultBranch "with space" &&
+ test_must_fail git init initial-branch-invalid 2>err &&
+ test_i18ngrep "invalid branch name" err
+'
+
test_done