Re: [PATCH 6/8] ls-files tests: filter `.gitconfig` from `--others` output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 26, 2026, 00:44 UTC
- Message-ID
- <xmqqldea7dpg.fsf@gitster.g>
- In-Reply-To
- <ef57244778d8f72754801d80a9e7e8ad034cec28.1777042877.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 7 quoted lines
> +# Remove .gitconfig entries from a file in place. test-lib.sh may
> +# create $HOME/.gitconfig (e.g. to set safe.bareRepository) which
> +# can appear in ls-files or status output.
> +test_filter_gitconfig () {
> + sed "/\\.gitconfig/d" "$1" >"$1.filtered" &&
> + mv "$1.filtered" "$1"
> +}Thanks.
When I suggested the "just use the usual configuration mechanism to keep the semantics of existing bare repository tests, and that would be very unintrusive", I didn't think of this fallout from an extra file getting reported by ls-files, and this helper function does make sense. If we were starting from scratch, we probably would have created $HOME that is separate from the test repository in the test framework. The simplest layout would be to emulate a developer who has repositories under their $HOME, i.e., $TRASH_DIRECTORY stays to be the $HOME, but the initial test repository would be created as a directory inside $TRASH_DIRECTORY instead of using the trash itself, or something like that. It is all water under the bridge now, unless somebody wants an opportunity to work on a non-trivial clean-up.
By the way, when merged to 'seen', with the 'ps/test-set-e-clean' topic already in 'next', many tests (especially the ones with early test_done, like p4 tests in my environment where p4 does not exist) seem to fail with WITH_BREAKING_CHANGES turned on. I don't have enough time to be sitting in front of the keyboard to isolate the cause, but because this series is one of the topics with biggest impact to the t/ directory that was replaced after the last successful run, I thought I should mention it.