Tests: Fix CTest.UpdateGIT under repo-local defaultBranch config

The default branch detection added by commit 26ec2e2b0c (Tests: Update
CTest.UpdateGIT test for custom defaultBranch, 2020-12-02,
v3.20.0-rc1~355^2) fails if the test is run inside a Git work tree whose
`.git` directory configures a `defaultBranch` that is different from the
global or system-wide value.  Fix the detection to ignore the locally
configured value so that we match the `git init` decision.
This commit is contained in:
Brad King 2022-11-11 14:50:55 -05:00
parent 31893e8c8f
commit b0d16c7f74

View File

@ -34,7 +34,7 @@ endif()
# Adapt to the system default branch name.
execute_process(
COMMAND ${GIT} config --get init.defaultBranch
COMMAND ${GIT} --git-dir= config --get init.defaultBranch
RESULT_VARIABLE defaultBranchFailed
OUTPUT_VARIABLE defaultBranch
ERROR_VARIABLE defaultBranchError