Subject: Re: [PATCH 6/8] ls-files tests: filter `.gitconfig` from `--others` output

From: Junio C Hamano <[email-masked]>
Date: Sun, 26 Apr 2026 09:44:11 +0900

"Johannes Schindelin via GitGitGadget" <[email-masked]>
writes:

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