git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 00/17] tests: access bare repositories explicitly

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 2, 2026, 14:33 UTC
Message-ID
<pull.2076.git.1775140403.gitgitgadget@gmail.com>

The safe.bareRepository configuration variable (introduced in 8d1a7448206e) allows restricting implicit bare repository discovery. Its default may well change to "explicit" in Git v3.0, at which point any test that relies on implicit discovery of a bare repository would break, even if the test subject has nothing to do with bare repositories.

This series adjusts 16 test scripts and git-p4 so that they access bare repositories explicitly. The techniques used are:

 * Replace git -C <bare-repo> ... with git --git-dir=<bare-repo> ...
 * Export GIT_DIR=. after cd-ing into a bare repository
 * Wrap commands in (GIT_DIR=<path> && export GIT_DIR && ...)
 * Add test_config_global safe.bareRepository all in the few tests where
   implicit discovery is genuinely part of what is being tested

Each commit is a self-contained fix to one test file (or a small related group).

This patch series is part of https://github.com/gitgitgadget/git/pull/2072.
Johannes Schindelin (17):
  t0001: allow implicit bare repo discovery for aliased-command test
  t0001: replace `cd`+`git` with `git --git-dir` in `check_config`
  t0003: use `--git-dir` for bare repo attribute tests
  t0056: allow implicit bare repo discovery for `-C` work-tree tests
  t1020: use `--git-dir` instead of subshell for bare repo
  t1900: avoid using `-C <dir>` for a bare repository
  t2400: explicitly specify bare repo for `git worktree add`
  t2406: use `--git-dir=.` for bare repository worktree repair
  t5503: avoid discovering a bare repository
  t5505: export `GIT_DIR` after `git init --bare`
  t5509: specify bare repository path explicitly
  t5540/t5541: avoid accessing a bare repository via `-C <dir>`
  t5619: wrap `test_commit_bulk` in `GIT_DIR` subshell for bare repo
  t6020: use `-C` for worktree, `--git-dir` for bare repository
  t9210: pass `safe.bareRepository=all` to `scalar register`
  t9700: stop relying on implicit bare repo discovery
  git p4 clone --bare: need to be explicit about the gitdir
 git-p4.py                                  |  1 +
 t/lib-httpd.sh                             | 12 ++--
 t/t0001-init.sh                            |  5 +-
 t/t0003-attributes.sh                      | 66 +++++++++-------------
 t/t0056-git-C.sh                           |  2 +
 t/t1020-subdirectory.sh                    |  5 +-
 t/t1900-repo-info.sh                       |  7 ++-
 t/t2400-worktree-add.sh                    | 21 +++----
 t/t2406-worktree-repair.sh                 |  2 +-
 t/t5503-tagfollow.sh                       | 13 ++---
 t/t5505-remote.sh                          |  4 +-
 t/t5509-fetch-push-namespaces.sh           | 12 ++--
 t/t5619-clone-local-ambiguous-transport.sh |  2 +-
 t/t6020-bundle-misc.sh                     |  4 +-
 t/t9210-scalar.sh                          |  2 +-
 t/t9700/test.pl                            |  9 ++-
 16 files changed, 74 insertions(+), 93 deletions(-)
base-commit: cf2139f8e1680b076e115bc0b349e369b4b0ecc4
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2076%2Fdscho%2Ftests-explicit-bare-repo-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2076/dscho/tests-explicit-bare-repo-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2076
-- 
gitgitgadget
Next: Johannes Schindelin via GitGitGadget
Message 1 of 44 in “tests: access bare repositories explicitly”
  1. 00/17 tests: access bare repositories explicitlyJohannes Schindelin via GitGitGadget, Apr 2, 2026
  2. 01/17 t0001: allow implicit bare repo discovery for aliased-command testJohannes Schindelin via GitGitGadget, Apr 2, 2026
  3. 02/17 t0001: replace `cd`+`git` with `git --git-dir` in `check_config`Johannes Schindelin via GitGitGadget, Apr 2, 2026
  4. 03/17 t0003: use `--git-dir` for bare repo attribute testsJohannes Schindelin via GitGitGadget, Apr 2, 2026
  5. 04/17 t0056: allow implicit bare repo discovery for `-C` work-tree testsJohannes Schindelin via GitGitGadget, Apr 2, 2026
  6. 05/17 t1020: use `--git-dir` instead of subshell for bare repoJohannes Schindelin via GitGitGadget, Apr 2, 2026
  7. 06/17 t1900: avoid using `-C <dir>` for a bare repositoryJohannes Schindelin via GitGitGadget, Apr 2, 2026
  8. 07/17 t2400: explicitly specify bare repo for `git worktree add`Johannes Schindelin via GitGitGadget, Apr 2, 2026
  9. 08/17 t2406: use `--git-dir=.` for bare repository worktree repairJohannes Schindelin via GitGitGadget, Apr 2, 2026
  10. 09/17 t5503: avoid discovering a bare repositoryJohannes Schindelin via GitGitGadget, Apr 2, 2026
  11. 10/17 t5505: export `GIT_DIR` after `git init --bare`Johannes Schindelin via GitGitGadget, Apr 2, 2026
  12. 11/17 t5509: specify bare repository path explicitlyJohannes Schindelin via GitGitGadget, Apr 2, 2026
  13. Junio C HamanoApr 2, 2026
  14. Johannes SchindelinApr 3, 2026
  15. Junio C HamanoApr 3, 2026
  16. Johannes SchindelinApr 4, 2026
  17. 12/17 t5540/t5541: avoid accessing a bare repository via `-C <dir>`Johannes Schindelin via GitGitGadget, Apr 2, 2026
  18. 13/17 t5619: wrap `test_commit_bulk` in `GIT_DIR` subshell for bare repoJohannes Schindelin via GitGitGadget, Apr 2, 2026
  19. 14/17 t6020: use `-C` for worktree, `--git-dir` for bare repositoryJohannes Schindelin via GitGitGadget, Apr 2, 2026
  20. 15/17 t9210: pass `safe.bareRepository=all` to `scalar register`Johannes Schindelin via GitGitGadget, Apr 2, 2026
  21. 16/17 t9700: stop relying on implicit bare repo discoveryJohannes Schindelin via GitGitGadget, Apr 2, 2026
  22. 17/17 git p4 clone --bare: need to be explicit about the gitdirJohannes Schindelin via GitGitGadget, Apr 2, 2026
  23. Junio C HamanoApr 2, 2026
  24. Johannes SchindelinApr 4, 2026
  25. Junio C HamanoApr 6, 2026
  26. 00/17 tests: access bare repositories explicitlyJohannes Schindelin via GitGitGadget, Apr 4, 2026
  27. 01/17 t0001: allow implicit bare repo discovery for aliased-command testJohannes Schindelin via GitGitGadget, Apr 4, 2026
  28. Junio C HamanoApr 6, 2026
  29. 02/17 t0001: replace `cd`+`git` with `git --git-dir` in `check_config`Johannes Schindelin via GitGitGadget, Apr 4, 2026
  30. 03/17 t0003: use `--git-dir` for bare repo attribute testsJohannes Schindelin via GitGitGadget, Apr 4, 2026
  31. 04/17 t0056: allow implicit bare repo discovery for `-C` work-tree testsJohannes Schindelin via GitGitGadget, Apr 4, 2026
  32. 05/17 t1020: use `--git-dir` instead of subshell for bare repoJohannes Schindelin via GitGitGadget, Apr 4, 2026
  33. 06/17 t1900: avoid using `-C <dir>` for a bare repositoryJohannes Schindelin via GitGitGadget, Apr 4, 2026
  34. 07/17 t2400: explicitly specify bare repo for `git worktree add`Johannes Schindelin via GitGitGadget, Apr 4, 2026
  35. 08/17 t2406: use `--git-dir=.` for bare repository worktree repairJohannes Schindelin via GitGitGadget, Apr 4, 2026
  36. 09/17 t5503: avoid discovering a bare repositoryJohannes Schindelin via GitGitGadget, Apr 4, 2026
  37. 10/17 t5505: export `GIT_DIR` after `git init --bare`Johannes Schindelin via GitGitGadget, Apr 4, 2026
  38. 11/17 t5509: specify bare repository path explicitlyJohannes Schindelin via GitGitGadget, Apr 4, 2026
  39. 12/17 t5540/t5541: avoid accessing a bare repository via `-C <dir>`Johannes Schindelin via GitGitGadget, Apr 4, 2026
  40. 13/17 t5619: wrap `test_commit_bulk` in `GIT_DIR` subshell for bare repoJohannes Schindelin via GitGitGadget, Apr 4, 2026
  41. 14/17 t6020: use `-C` for worktree, `--git-dir` for bare repositoryJohannes Schindelin via GitGitGadget, Apr 4, 2026
  42. 15/17 t9210: pass `safe.bareRepository=all` to `scalar register`Johannes Schindelin via GitGitGadget, Apr 4, 2026
  43. 16/17 t9700: stop relying on implicit bare repo discoveryJohannes Schindelin via GitGitGadget, Apr 4, 2026
  44. 17/17 git p4 clone --bare: need to be explicit about the gitdirJohannes Schindelin via GitGitGadget, Apr 4, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.