From: Junio C Hamano Date: Fri, 06 Nov 2026 13:08:09 GMT Subject: Re: [PATCH v3 1/2] t1300: test list with missing global config Message-ID: In-Reply-To: <20261009-fix-config-list-global-home-and-xdg-v3-1-f936b9c8a0cc@microsoft.com> Delilah Ashley Wu writes: > 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(+) OK. > 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 > +' Do we know that XDG stuff is always ~/.config/git/config? Other tests that deal with XDG config files like t0007 seem to make sure XDG_CONFIG_HOME is at a place known to the tests by setting and exporting XDG_CONFIG_HOME; perhaps it does not matter? > test_expect_success 'override global and system config' ' > test_when_finished rm -f \"\$HOME\"/.gitconfig && > cat >"$HOME"/.gitconfig <<-EOF &&