]> Kevux Git Server - rit/commit
ls-files tests: filter `.gitconfig` from `--others` output
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 26 Apr 2026 14:38:34 +0000 (14:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Apr 2026 05:50:53 +0000 (14:50 +0900)
commit83228f16611eae979421915836c5416eb4d02cf3
tree77524598d89bae0e2ded1597535e82ad1f62cdd1
parentd97f27bf01a1ba2cfa66cc8e55f03e701084240e
ls-files tests: filter `.gitconfig` from `--others` output

The global `safe.bareRepository=all` setting in test-lib.sh is
written to `$HOME/.gitconfig`, which unfortunately lives inside the
test repository's working tree. The `.git/info/exclude` entry added
alongside it handles most commands, but `git ls-files --others`
without `--exclude-standard` does not consult `info/exclude` at
all, so the file appears in the output.

Ideally, each test that accesses a bare repository would simply
specify `--git-dir` or `GIT_DIR` explicitly, which would require no
global config and produce no side effects in the working tree. As
that approach was not taken, filter `.gitconfig` from the output
before comparing against expected results. In t7104, the test
already uses `--exclude-standard`, so it suffices to switch from
the bare `git ls-files -o` to `git ls-files -o --exclude-standard`
which respects the `info/exclude` entry; the other tests
deliberately omit `--exclude-standard` because their purpose is to
verify unfiltered `--others` output.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3000-ls-files-others.sh
t/t3001-ls-files-others-exclude.sh
t/t3002-ls-files-dashpath.sh
t/t3009-ls-files-others-nonsubmodule.sh
t/t3011-common-prefixes-and-directory-traversal.sh
t/t7104-reset-hard.sh
t/test-lib-functions.sh