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

Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program

From
Jeff King <peff@peff.net>
Date
Jul 25, 2025, 05:13 UTC
Message-ID
<20250725051309.GA3003751@coredump.intra.peff.net>
In-Reply-To
<20250725043043.GA3002998@coredump.intra.peff.net>
On Fri, Jul 25, 2025 at 12:30:43AM -0400, Jeff King wrote:
> This second test seems to fail on Windows. E.g., in this CI job:
> [...]
> Should it be "/d/a/git/git/..." instead of "D:/a/git/git/..."? Which we
> could get by using $PWD, I think.

Yeah, that is it. I found a commit with some prior art, and here is the passing CI result:

  https://github.com/peff/git/actions/runs/16513873854
> The earlier one using $HOME uses D:/, but this one is different because
> colons are meaningful separators in $PATH.

I do wonder if that one needs to set $HOME at all. The test harness already points $HOME to the trash directory. But maybe it has value to document the expectation.

Anyway, here is the fix as a patch on top of jb/t7510-gpg-program-path. I am also happy for it to be squashed in, since I think the topic is not yet in 'next'.

-- >8 --
Subject: [PATCH] t7510: use $PWD instead of $(pwd) inside PATH

On Windows, $(pwd) will give us a Windows-style path like "D:/foo". Putting that into $PATH confuses anybody parsing that variable, since colon is a separator character in $PATH. Instead, we should use the Unix-style value we get from $PWD ("/d/foo").

This is similar to the cases fixed by 71dd50472d (t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables, 2016-11-11).

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t7510-signed-commit.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 95d2ebe277..1201c85ba6 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -458,7 +458,7 @@ test_expect_success 'custom `gpg.program`' '
 
 	# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`
 	test_config gpg.program "fake-gpg" &&
-	env PATH="$(pwd):$PATH" \
+	env PATH="$PWD:$PATH" \
 	git commit -S --allow-empty -m signed-commit
 '
 
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 15 in “[BUG] gpg.program: '~' not expanded to home directory”
  1. Ross MacArthurJul 11, 2025
  2. gpg-interface: expand gpg.program as a pathJonas Brandstötter, Jul 11, 2025
  3. Junio C HamanoJul 14, 2025
  4. 0/2 gpg-interface: expand gpg.program as a pathJonas Brandstötter, Jul 22, 2025
  5. Junio C HamanoJul 22, 2025
  6. 1/2 gpg-interface: expand gpg.program as a pathJonas Brandstötter, Jul 22, 2025
  7. 2/2 t7510: add test cases for non-absolute gpg programJonas Brandstötter, Jul 22, 2025
  8. Jeff KingJul 25, 2025
  9. Jeff KingJul 25, 2025
  10. Junio C HamanoJul 29, 2025
  11. Jeff KingJul 29, 2025
  12. Junio C HamanoJul 29, 2025
  13. Junio C HamanoJul 12, 2025
  14. Andreas SchwabJul 12, 2025
  15. Junio C HamanoJul 12, 2025

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.