Re: [PATCH v3 1/2] t1300: test list with missing global config
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 6, 2026, 13:08 UTC
- Message-ID
- <xmqqeccym7k6.fsf@gitster.g>
- In-Reply-To
- <20261009-fix-config-list-global-home-and-xdg-v3-1-f936b9c8a0cc@microsoft.com>
Delilah Ashley Wu <delilahwu@linux.microsoft.com> writes:
Show 16 quoted lines
> From: Delilah Ashley Wu <delilahwu@microsoft.com> > > 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 <delilahwu@microsoft.com> > --- > t/t1300-config.sh | 12 ++++++++++++ > 1 file changed, 12 insertions(+)
OK.
Show 19 quoted lines
> 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 &&