Tests: Fix CTest.UpdateGIT under repo-local defaultBranch config
The default branch detection added by !5565 (merged) 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.
Backport this fix from !7905 (merged).
Backport: release