From: Delilah Ashley Wu Date: Fri, 09 Oct 2026 08:51:45 GMT Subject: [PATCH v3 1/2] t1300: test list with missing global config Message-ID: <20261009-fix-config-list-global-home-and-xdg-v3-1-f936b9c8a0cc@microsoft.com> In-Reply-To: <20261009-fix-config-list-global-home-and-xdg-v3-0-f936b9c8a0cc@microsoft.com> From: Delilah Ashley Wu Record behaviour in two new tests: when no global configuration file exists, `git config list` succeeds whereas `git config list --global` fails. Only check the exit code, as we're not interested in the exact error message. This prevents regressions in the next patch, "config: read global scope via config_sequence", which modifies `do_git_config_sequence()` to optionally return a failure if no global configuration files were successfully read (i.e. when the `--global` flag is specified). Signed-off-by: Delilah Ashley Wu --- t/t1300-config.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/t/t1300-config.sh b/t/t1300-config.sh index e3f8064889..df8c14da0d 100755 --- a/t/t1300-config.sh +++ b/t/t1300-config.sh @@ -2425,6 +2425,18 @@ test_expect_success '--show-scope with --default' ' test_cmp expect actual ' +test_expect_success 'list with nonexistent global config gracefully exits' ' + rm -f "$HOME"/.gitconfig "$HOME"/.config/git/config && + git config ${mode_prefix}list && + git config ${mode_prefix}list --show-scope +' + +test_expect_success 'list --global with nonexistent global config fails' ' + rm -f "$HOME"/.gitconfig "$HOME"/.config/git/config && + test_must_fail git config ${mode_prefix}list --global && + test_must_fail git config ${mode_prefix}list --global --show-scope +' + test_expect_success 'override global and system config' ' test_when_finished rm -f \"\$HOME\"/.gitconfig && cat >"$HOME"/.gitconfig <<-EOF && -- 2.54.0