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

2 messages, 2 authors, 2026-04-03 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2026-04-02 20:44:17

"Johannes Schindelin via GitGitGadget" [off-list ref]
writes:
quoted hunk
 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.
quoted hunk
 	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
 '

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

From: Johannes Schindelin <hidden>
Date: 2026-04-03 14:22:43

Hi Junio,

On Fri, 3 Apr 2026, Junio C Hamano wrote:
"Johannes Schindelin via GitGitGadget" [off-list ref]
writes:
quoted
 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.
It would be indeed more conservative, and it even results in less changes
when done in a more elegant fashion, by appending `--git-dir=.` after the
`-C pushee`, as the patches "t2400: explicitly specify bare repo for `git
worktree add`" and "t2406: use `--git-dir=.` for bare repository worktree
repair" already do. That will not only result in vastly less changed lines
(and hence less cognitive load on any reviewer), but also avoid the
proposed subshell. I'll go with `--git-dir=.`, then.

Ciao,
Johannes
quoted
 	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
 '
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help