From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/8] test-lib: allow bare repository access when breaking changes are enabled
Date: Fri, 24 Apr 2026 15:01:10 +0000 [thread overview]
Message-ID: <62707b410977af2c80d98306455aaec55499f606.1777042877.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2098.git.1777042877.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
A future patch will change the `safe.bareRepository` default from
`all` to `explicit` under `WITH_BREAKING_CHANGES`. At that point,
every test that operates on a bare repository through implicit
discovery would fail, regardless of whether the test is actually
about discovery or about how a specific command behaves once inside
a bare repository.
The maintainer suggested [1] setting `safe.bareRepository=all` in
the test environment's global config whenever `WITH_BREAKING_CHANGES`
is in effect, rather than adjusting each affected test to access
bare repositories explicitly (via `--git-dir`, `GIT_DIR`, or
similar). This means the test suite continues to exercise only the
historical default behavior even after the user-facing default
changes, relying on a small number of dedicated tests in t0035 to
validate the new, stricter default.
Since `$HOME` points at the trash directory (which doubles as the
test repository's working tree), writing to `$HOME/.gitconfig` also
creates a file inside the working tree. Exclude it via
`.git/info/exclude` to limit the fallout, though this does not
help tests that use `git ls-files --others` without
`--exclude-standard` or `git status --ignored`; those are addressed
by subsequent commits.
[1] https://lore.kernel.org/git/xmqqse98cc51.fsf@gitster.g/
Original-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
t/test-lib.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 70fd3e9baf..b8726f4647 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1597,6 +1597,12 @@ cd -P "$TRASH_DIRECTORY" || BAIL_OUT "cannot cd -P to \"$TRASH_DIRECTORY\""
TRASH_DIRECTORY=$(pwd)
HOME="$TRASH_DIRECTORY"
+if test -n "$WITH_BREAKING_CHANGES"
+then
+ git config --global safe.bareRepository all &&
+ echo "/.gitconfig" >>.git/info/exclude
+fi
+
start_test_output "$0"
# Convenience
--
gitgitgadget
next prev parent reply other threads:[~2026-04-24 15:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 15:01 [PATCH 0/8] safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGES Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` Johannes Schindelin via GitGitGadget [this message]
2026-04-24 15:01 ` [PATCH 2/8] t7900: do not let `$HOME/.gitconfig` interfere with XDG tests Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` [PATCH 3/8] t1300: remove global config settings injected by test-lib.sh Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` [PATCH 4/8] t1305: use `--git-dir=.` for bare repo in include cycle test Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` [PATCH 5/8] t5601: restore `.gitconfig` after includeIf test Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` [PATCH 6/8] ls-files tests: filter `.gitconfig` from `--others` output Johannes Schindelin via GitGitGadget
2026-04-26 0:44 ` Junio C Hamano
2026-04-24 15:01 ` [PATCH 7/8] status tests: filter `.gitconfig` from status output Johannes Schindelin via GitGitGadget
2026-04-24 15:01 ` [PATCH 8/8] safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGES Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 0/8] " Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 1/8] test-lib: allow bare repository access when breaking changes are enabled Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 2/8] t7900: do not let `$HOME/.gitconfig` interfere with XDG tests Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 3/8] t1300: remove global config settings injected by test-lib.sh Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 4/8] t1305: use `--git-dir=.` for bare repo in include cycle test Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 5/8] t5601: restore `.gitconfig` after includeIf test Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 6/8] ls-files tests: filter `.gitconfig` from `--others` output Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 7/8] status tests: filter `.gitconfig` from status output Johannes Schindelin via GitGitGadget
2026-04-26 14:38 ` [PATCH v2 8/8] safe.bareRepository: default to "explicit" with WITH_BREAKING_CHANGES Johannes Schindelin via GitGitGadget
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=62707b410977af2c80d98306455aaec55499f606.1777042877.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
/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