]> git.ipfire.org Git - thirdparty/git.git/commit
config: test home and xdg files in `list --global`
authorDelilah Ashley Wu <delilahwu@microsoft.com>
Fri, 10 Oct 2025 01:14:07 +0000 (01:14 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Nov 2025 15:14:26 +0000 (07:14 -0800)
commiteea016940e57538ae75c665db3decf664f5be1d8
tree9210f0869ac6b55dc1ef4b2bf445bfe741dec229
parentdfd106387681aff6f79b72731aae505a5c5d28e7
config: test home and xdg files in `list --global`

The `git config list --global` output includes `$HOME/.gitconfig` (home
config), but ignores `$XDG_CONFIG_HOME/git/config` (XDG config). It
should include both files.

Modify tests to check the following and expect a failure:
  - `git config list --global` should include contents from both the
     home and XDG config locations (assuming they are readable), not
     just the former.

  - `--show-origin` should print correct paths to both config files,
    assuming they exist.

Also, add tests to ensure subsequent patches do not introduce
regressions to `git config list`. Specifically, check that:
  - The home config should take precedence over the XDG config.

  - Without `--global`, it should not bail on unreadable/non-existent
    global config files.

  - With `--global`, it should bail when both `$HOME/.gitconfig` and
    `$XDG_CONFIG_HOME/git/config` are unreadable. It should not bail if
    at least one of them is readable.

The next patch, config: read global scope via config_sequence, will
implement a fix to include both config files when `--global` is
specified.

Reported-by: Jade Lovelace <lists@jade.fyi>
Helped-by: Derrick Stolee <stolee@gmail.com>
Signed-off-by: Delilah Ashley Wu <delilahwu@microsoft.com>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1300-config.sh
t/t1306-xdg-files.sh