From 8747ebb7cde9e90d20794c06e6806f75cd540142 Mon Sep 17 00:00:00 2001 From: Don Goodman-Wilson Date: Wed, 24 Jun 2020 14:46:33 +0000 Subject: init: allow setting the default for the initial branch name via the config We just introduced the command-line option `--initial-branch=` 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 Helped-by: Derrick Stolee Signed-off-by: Don Goodman-Wilson Signed-off-by: Junio C Hamano --- t/t0001-init.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') 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 -- cgit v1.2.3