Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Delilah Ashley Wu <delilahwu@linux.microsoft.com>
Cc: git@vger.kernel.org,  Derrick Stolee <stolee@gmail.com>,
	 Chris Torek <chris.torek@gmail.com>,
	 Patrick Steinhardt <ps@pks.im>,
	 Delilah Ashley Wu <delilahwu@microsoft.com>,
	 Ben Knoble <ben.knoble@gmail.com>,
	 Nils Fahldieck <nils@fahldieck.de>,
	 Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	 Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v3 1/2] t1300: test list with missing global config
Date: Fri, 06 Nov 2026 05:08:09 -0800	[thread overview]
Message-ID: <xmqqeccym7k6.fsf@gitster.g> (raw)
In-Reply-To: <20261009-fix-config-list-global-home-and-xdg-v3-1-f936b9c8a0cc@microsoft.com> (Delilah Ashley Wu's message of "Fri, 09 Oct 2026 19:51:45 +1100")

Delilah Ashley Wu <delilahwu@linux.microsoft.com> writes:

> 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.

> 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 &&

  reply	other threads:[~2026-11-06 13:08 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10  1:14 [PATCH/RFC 0/4] config: read both home and xdg files for --global Delilah Ashley Wu via GitGitGadget
2025-10-10  1:14 ` [PATCH/RFC 1/4] cleanup_path: force forward slashes on Windows Delilah Ashley Wu via GitGitGadget
2025-11-19 17:47   ` Junio C Hamano
2025-10-10  1:14 ` [PATCH/RFC 2/4] config: test home and xdg files in `list --global` Delilah Ashley Wu via GitGitGadget
2025-11-19 18:29   ` Junio C Hamano
2025-10-10  1:14 ` [PATCH/RFC 3/4] config: read global scope via config_sequence Delilah Ashley Wu via GitGitGadget
2025-11-19 18:39   ` Junio C Hamano
2025-10-10  1:14 ` [PATCH/RFC 4/4] config: keep bailing on unreadable global files Delilah Ashley Wu via GitGitGadget
2025-10-10  1:27 ` [PATCH/RFC 0/4] config: read both home and xdg files for --global Kristoffer Haugsbakk
2025-11-22  1:36   ` Delilah Ashley Wu
2026-01-20 20:41     ` Junio C Hamano
2025-11-17 13:29 ` Johannes Schindelin
2025-11-18  0:28   ` Junio C Hamano
2025-11-19 14:44 ` Junio C Hamano
2025-11-22  2:00   ` Delilah Ashley Wu
2026-08-23 10:28 ` [PATCH v2 0/3] " Delilah Ashley Wu
2026-08-23 10:28   ` [PATCH v2 1/3] path: use forward slashes in XDG config on Windows Delilah Ashley Wu
2026-08-26 17:58     ` Junio C Hamano
2026-09-10  4:48       ` Delilah Ashley Wu
2026-10-09  2:49         ` Delilah Ashley Wu
2026-08-23 10:28   ` [PATCH v2 2/3] config: let sequence require a successful file Delilah Ashley Wu
2026-08-26 18:20     ` Junio C Hamano
2026-10-09  9:11       ` Delilah Ashley Wu
2026-08-23 10:28   ` [PATCH v2 3/3] config: read global scope via config_sequence Delilah Ashley Wu
2026-08-26 18:38     ` Junio C Hamano
2026-08-23 12:36   ` [PATCH v2 0/3] config: read both home and xdg files for --global Chris Torek
2026-08-24  1:32     ` Junio C Hamano
2026-10-09  8:51 ` [PATCH v3 0/2] " Delilah Ashley Wu
2026-10-09  8:51   ` [PATCH v3 1/2] t1300: test list with missing global config Delilah Ashley Wu
2026-11-06 13:08     ` Junio C Hamano [this message]
2026-10-09  8:51   ` [PATCH v3 2/2] config: read global scope via config_sequence Delilah Ashley Wu
2026-11-06 13:28     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqeccym7k6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=ben.knoble@gmail.com \
    --cc=chris.torek@gmail.com \
    --cc=delilahwu@linux.microsoft.com \
    --cc=delilahwu@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=nils@fahldieck.de \
    --cc=ps@pks.im \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox