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

Re: [PATCH 11/17] t5509: specify bare repository path explicitly

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 2, 2026, 20:44 UTC
Message-ID
<xmqq341dozxc.fsf@gitster.g>
In-Reply-To
<f6fc807af627701bf7f9ea413c7714e9bc01aea4.1775140403.git.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 6 quoted lines
>  test_expect_success 'hide namespaced refs with transfer.hideRefs' '
>  	GIT_NAMESPACE=namespace \
> -		git -C pushee -c transfer.hideRefs=refs/tags \
> -		ls-remote "ext::git %s ." >actual &&
> +		git --git-dir=pushee -c transfer.hideRefs=refs/tags \
> +		ls-remote "ext::git %s pushee" >actual &&

Hmph. The command being ls-remote (which does not care what state your working tree files are), the above may work, but rewriting "-C there" with "--git-dir=there" changes the semantics of the program, no? A more conservative rewrite that would preserve what the original wanted to test would be to ...

	(
		cd pushee &&
		git --git-dir=. -c ... ls-remote ...
	)
... do this instead, I think.
Show 25 quoted lines
>  	printf "$commit1\trefs/heads/main\n" >expected &&
>  	test_cmp expected actual
>  '
> @@ -97,8 +97,8 @@ test_expect_success 'hide namespaced refs with transfer.hideRefs' '
>  test_expect_success 'check that transfer.hideRefs does not match unstripped refs' '
>  	git -C pushee pack-refs --all &&
>  	GIT_NAMESPACE=namespace \
> -		git -C pushee -c transfer.hideRefs=refs/namespaces/namespace/refs/tags \
> -		ls-remote "ext::git %s ." >actual &&
> +		git --git-dir=pushee -c transfer.hideRefs=refs/namespaces/namespace/refs/tags \
> +		ls-remote "ext::git %s pushee" >actual &&
>  	printf "$commit1\trefs/heads/main\n" >expected &&
>  	printf "$commit0\trefs/tags/0\n" >>expected &&
>  	printf "$commit1\trefs/tags/1\n" >>expected &&
> @@ -107,8 +107,8 @@ test_expect_success 'check that transfer.hideRefs does not match unstripped refs
>  
>  test_expect_success 'hide full refs with transfer.hideRefs' '
>  	GIT_NAMESPACE=namespace \
> -		git -C pushee -c transfer.hideRefs="^refs/namespaces/namespace/refs/tags" \
> -		ls-remote "ext::git %s ." >actual &&
> +		git --git-dir=pushee -c transfer.hideRefs="^refs/namespaces/namespace/refs/tags" \
> +		ls-remote "ext::git %s pushee" >actual &&
>  	printf "$commit1\trefs/heads/main\n" >expected &&
>  	test_cmp expected actual
>  '
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin
Message 13 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.