git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Jonas Brandstötter" <jonas.brandstoetter@gmx.at>, git@vger.kernel.org
Subject: Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program
Date: Mon, 28 Jul 2025 17:05:46 -0700	[thread overview]
Message-ID: <xmqq5xfbuahx.fsf@gitster.g> (raw)
In-Reply-To: <20250725043043.GA3002998@coredump.intra.peff.net> (Jeff King's message of "Fri, 25 Jul 2025 00:30:43 -0400")

Jeff King <peff@peff.net> writes:

> This second test seems to fail on Windows. E.g., in this CI job:
>
>   https://github.com/git/git/actions/runs/16509422831/job/46688307091
>
> Right before the failure, the trace shows that we are setting PATH like
> this:
>
>   ++env 'PATH=D:/a/git/git/t/trash directory.t7510-signed-commit:/d/a/git/git:/d/a/git/git/t/helper:/c/Users/runneradmin/path:/mingw64/bin:/usr/bin/:/usr/bin/core_perl:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem'
>
> Should it be "/d/a/git/git/..." instead of "D:/a/git/git/..."? Which we
> could get by using $PWD, I think.
>
> The earlier one using $HOME uses D:/, but this one is different because
> colons are meaningful separators in $PATH.

Here is what I have on top of the posted patches.  If today's
integration goes well, I plan to merge it to 'next'; the rest of the
series is already in 'next'.

---- >8 ----
Subject: [PATCH] t7510: Windows fix

$PATH and $(pwd) does not mix very well, because PATH is a colon
separated list of directories, but on Windows port of the shell
Git-for-Windows uses, $(pwd) looks like "D:/path/to/a/directory".

With $PWD, we would get /d/path/to/a/directory instead, which would
fit better on $PATH.  This broke Windows CI job.

While at it, drop unnecessary use of "env VAR=VAL" before "git
commit"; one-shot export "VAR=VAL git commit" is sufficient.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t7510-signed-commit.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 95d2ebe277..c51e2e2589 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -453,13 +453,11 @@ test_expect_success 'custom `gpg.program`' '
 
 	# `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`
 	test_config gpg.program "~/fake-gpg" &&
-	env HOME="$(pwd)" \
-	git commit -S --allow-empty -m signed-commit &&
+	HOME="$(pwd)" git commit -S --allow-empty -m signed-commit &&
 
 	# `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" \
-	git commit -S --allow-empty -m signed-commit
+	PATH="$PWD:$PATH" git commit -S --allow-empty -m signed-commit
 '
 
 test_done
-- 
2.50.1-589-gf1cdebda82


  parent reply	other threads:[~2025-07-29  0:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-11 15:04 [BUG] gpg.program: '~' not expanded to home directory Ross MacArthur
2025-07-11 23:23 ` [PATCH] gpg-interface: expand gpg.program as a path Jonas Brandstötter
2025-07-14 17:10   ` Junio C Hamano
2025-07-22 19:09   ` [PATCH v2 0/2] " Jonas Brandstötter
2025-07-22 20:28     ` Junio C Hamano
2025-07-22 19:09   ` [PATCH v2 1/2] " Jonas Brandstötter
2025-07-22 19:09   ` [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program Jonas Brandstötter
2025-07-25  4:30     ` Jeff King
2025-07-25  5:13       ` Jeff King
2025-07-29  0:05       ` Junio C Hamano [this message]
2025-07-29  7:12         ` Jeff King
2025-07-29 15:06           ` Junio C Hamano
2025-07-12  0:05 ` [BUG] gpg.program: '~' not expanded to home directory Junio C Hamano
2025-07-12  9:38   ` Andreas Schwab
2025-07-12 14:08     ` Junio C Hamano

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=xmqq5xfbuahx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonas.brandstoetter@gmx.at \
    --cc=peff@peff.net \
    /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;
as well as URLs for NNTP newsgroup(s).