Skip to content

Commit 97c8aac

Browse files
avargitster
authored andcommitted
test-lib: do not show advice about init.defaultBranch under --verbose
Arrange for the advice about naming the initial branch not to be shown in the --verbose output of the test suite. Since 675704c (init: provide useful advice about init.defaultBranch, 2020-12-11) some tests have been very chatty with repeated occurrences of this multi-line advice. Having it be this verbose isn't helpful for anyone in the context of git's own test suite, and it makes debugging tests that use their own "git init" invocations needlessly distracting. By setting the GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME variable early in test-lib.sh itself we'll squash the warning not only for test_create_repo(), as 675704c explicitly intended, but also for other "git init" invocations. And once we'd like to have this configuration set for all "git init" invocations in the test suite we can get rid of the init.defaultBranch configuration setting in test_create_repo(), as repo_default_branch_name() in refs.c will take the GIT_TEST_* variable over it being set. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 04d12d6 commit 97c8aac

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

t/test-lib-functions.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,6 @@ test_create_repo () {
12601260
(
12611261
cd "$repo" || error "Cannot setup test environment"
12621262
"${GIT_TEST_INSTALLED:-$GIT_EXEC_PATH}/git$X" \
1263-
-c init.defaultBranch="${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME-master}" \
12641263
init \
12651264
"--template=$GIT_BUILD_DIR/templates/blt/" >&3 2>&4 ||
12661265
error "cannot run git init -- have you built things yet?"

t/test-lib.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ then
6464
export GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS
6565
fi
6666

67+
# Explicitly set the default branch name for testing, to avoid the
68+
# transitory "git init" warning under --verbose.
69+
: ${GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME:=master}
70+
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
71+
6772
################################################################
6873
# It appears that people try to run tests without building...
6974
"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null

0 commit comments

Comments
 (0)