chore: silence git init defaultBranch hints in script/test

Tests that create temp repos call `git init` without specifying a branch.
Git then prints a 12-line "hint: Using 'master' as the name for the
initial branch..." block — every test, every run. The output drowns out
actual failures.

Set init.defaultBranch=master via GIT_CONFIG_COUNT/KEY/VALUE env vars in
script/test. This affects only subprocesses spawned by the test runner;
no change to the user's real git config.

Verified: cargo test --bin huskies emits 0 `hint:` lines after this
change, all 2732 tests still pass.
This commit is contained in:
dave
2026-04-28 16:38:43 +00:00
parent 30dd4b3a0a
commit 3ff361bfe8
+7
View File
@@ -1,6 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Silence git's "default branch name" hints emitted on every `git init` in
# tests that create temp repos. Sets init.defaultBranch=master via env so we
# don't have to touch the user's real git config.
export GIT_CONFIG_COUNT=1
export GIT_CONFIG_KEY_0=init.defaultBranch
export GIT_CONFIG_VALUE_0=master
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"