{"thread":{"id":"63781","subject":"[BUG] gpg.program: '~' not expanded to home directory","startedAt":"2025-07-11T15:04:20Z","lastAt":"2025-07-29T15:06:07Z","messageCount":15,"participants":["Ross MacArthur","Jonas Brandstötter","Junio C Hamano","Andreas Schwab","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"521819","messageId":"CAF1X4d7N1xdZt9JkVZytbEU1=7q3X_F_nqm4EG82B8-cVa7g8Q@mail.gmail.com","threadId":"63781","inReplyTo":null,"subject":"[BUG] gpg.program: '~' not expanded to home directory","fromName":"Ross MacArthur","fromEmail":"ross@macarthur.io","sentAt":"2025-07-11T15:04:02Z","receivedAt":"2025-07-11T15:04:20Z","isPatch":false,"sender":{"key":"ross@macarthur.io","avatar":null},"body":"`gpg.program` treats a leading ‘~’ literally, unlike other path\noptions such as `core.excludesfile`.\n\nError:\n\n    fatal: cannot exec '~/.local/bin/mygpg': No such file or directory\n\nReproducer:\n\n    ln -s \"$(command -v gpg)\" ~/.local/bin/mygpg\n    git config gpg.program '~/.local/bin/mygpg'\n    git commit -S -m \"test\"   # fails as above\n\nExpected: Git should expand ‘~’ to $HOME.\nWork-around: have to use an absolute path\n"},{"id":"521854","messageId":"20250711232348.460804-1-jonas.brandstoetter@gmx.at","threadId":"63781","inReplyTo":"CAF1X4d7N1xdZt9JkVZytbEU1=7q3X_F_nqm4EG82B8-cVa7g8Q@mail.gmail.com","subject":"[PATCH] gpg-interface: expand gpg.program as a path","fromName":"Jonas Brandstötter","fromEmail":"jonas.brandstoetter@gmx.at","sentAt":"2025-07-11T23:23:47Z","receivedAt":"2025-07-11T23:24:36Z","isPatch":true,"sender":{"key":"jonas.brandstoetter@gmx.at","avatar":"https://avatars.githubusercontent.com/u/37748408?v=4"},"body":"This allows using a custom gpg program under the user's home directory\nby specifying a path starting with '~'\n\n[gpg]\n        program = \"~/.local/bin/mygpg\"\n\nSigned-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at>\n---\nFirst time interacting with a project via a mailing list. Do let me know if\nI did something very dumb.\n\n  Jonas\n Documentation/config/gpg.adoc | 2 +-\n gpg-interface.c               | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config/gpg.adoc b/Documentation/config/gpg.adoc\nindex 5cf32b179d..240e46c050 100644\n--- a/Documentation/config/gpg.adoc\n+++ b/Documentation/config/gpg.adoc\n@@ -1,5 +1,5 @@\n gpg.program::\n-\tUse this custom program instead of \"`gpg`\" found on `$PATH` when\n+\tPathname of the program to use instead of \"`gpg`\" when\n \tmaking or verifying a PGP signature. The program must support the\n \tsame command-line interface as GPG, namely, to verify a detached\n \tsignature, \"`gpg --verify $signature - <$file`\" is run, and the\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 0896458de5..3dfbc45385 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -783,7 +783,7 @@ static int git_gpg_config(const char *var, const char *value,\n\n \tif (fmtname) {\n \t\tfmt = get_format_by_name(fmtname);\n-\t\treturn git_config_string((char **) &fmt->program, var, value);\n+\t\treturn git_config_pathname((char **) &fmt->program, var, value);\n \t}\n\n \treturn 0;\n\nbase-commit: a30f80fde927d70950b3b4d1820813480968fb0d\n--\n2.50.1\n"},{"id":"521855","messageId":"xmqq8qkuxoh3.fsf@gitster.g","threadId":"63781","inReplyTo":"CAF1X4d7N1xdZt9JkVZytbEU1=7q3X_F_nqm4EG82B8-cVa7g8Q@mail.gmail.com","subject":"Re: [BUG] gpg.program: '~' not expanded to home directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-12T00:05:44Z","receivedAt":"2025-07-12T00:05:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ross MacArthur <ross@macarthur.io> writes:\n\n> `gpg.program` treats a leading ‘~’ literally, unlike other path\n> options such as `core.excludesfile`.\n\nI think that is correct; I do not think gpg.program is to give a\npath to the program, so comparison with core.excludesfile is\nprobably not so appropriate.\n\nIt gives a command line, e.g. \"mysign --compat=gnupg\", where the\nprogram \"mysign\" somewhere on your path can be told to behave in a\nway compatible to GPG when a command line option \"--compat=gnupg\" is\ngiven.  We further append our own command line options when we\ninvoke this command, like the \"git config --help\" on this variable\nsays.  When we want to verify GPG signature $signature in a file\n$file, for example, instead of running gpg, we would run:\n\n\tmysign --compat=gnupg --verify $signature - <$file\n\n> Expected: Git should expand ‘~’ to $HOME.\n\nSo this expectation does not quite hold true.\n\nI wonder if letting your shell to handle the tilde expansion would\nmake it work, though.  Continuing with the example, it may look\nsomething like this, perhaps?\n\n $ git config set gpg.program \"sh -c '~/mysign --compat=gnupg \\\"\\$@\\\"' -\"\n\n"},{"id":"521864","messageId":"87ple521gv.fsf@linux-m68k.org","threadId":"63781","inReplyTo":"xmqq8qkuxoh3.fsf@gitster.g","subject":"Re: [BUG] gpg.program: '~' not expanded to home directory","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2025-07-12T09:38:24Z","receivedAt":"2025-07-12T09:48:05Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Jul 11 2025, Junio C Hamano wrote:\n\n> I think that is correct; I do not think gpg.program is to give a\n> path to the program, so comparison with core.excludesfile is\n> probably not so appropriate.\n>\n> It gives a command line, e.g. \"mysign --compat=gnupg\",\n\ngpg-interface does not use the shell to run gpg.program, so this won't\nwork.\n\n$ git config gpg.program \"echo --compat=gnupg\"\n$ git commit -m foo -S\nerror: cannot run echo --compat=gnupg: No such file or directory\nerror: gpg failed to sign the data:\n(no gpg output)\nfatal: failed to write commit object\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1\n\"And now for something completely different.\"\n"},{"id":"521877","messageId":"xmqqy0stwlh5.fsf@gitster.g","threadId":"63781","inReplyTo":"87ple521gv.fsf@linux-m68k.org","subject":"Re: [BUG] gpg.program: '~' not expanded to home directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-12T14:08:06Z","receivedAt":"2025-07-12T14:08:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andreas Schwab <schwab@linux-m68k.org> writes:\n\n> On Jul 11 2025, Junio C Hamano wrote:\n>\n>> I think that is correct; I do not think gpg.program is to give a\n>> path to the program, so comparison with core.excludesfile is\n>> probably not so appropriate.\n>>\n>> It gives a command line, e.g. \"mysign --compat=gnupg\",\n>\n> gpg-interface does not use the shell to run gpg.program, so this won't\n> work.\n\nYou're right.  Thanks for correcting me.\n\nI should have gone to the code I wrote instead of answering from\nwhat I didn't see (namely, the word \"pathname\") in the\ndocumentation X-<.\n\n\n"},{"id":"521917","messageId":"xmqqy0sqsnor.fsf@gitster.g","threadId":"63781","inReplyTo":"20250711232348.460804-1-jonas.brandstoetter@gmx.at","subject":"Re: [PATCH] gpg-interface: expand gpg.program as a path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-14T17:10:44Z","receivedAt":"2025-07-14T17:10:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonas Brandstötter <jonas.brandstoetter@gmx.at> writes:\n\n> This allows using a custom gpg program under the user's home directory\n> by specifying a path starting with '~'\n>\n> [gpg]\n>         program = \"~/.local/bin/mygpg\"\n>\n> Signed-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at>\n> ---\n> First time interacting with a project via a mailing list. Do let me know if\n> I did something very dumb.\n\nThanks.  The update to the codumentation to explicitly say that the\nvariable is about \"pathname\" is a very nice touch, and the code\nchange is trivially correct, I guess.\n\nI wonder if we can have some test to protect this feature from\nbroken by mistake, though.\n\n>  Documentation/config/gpg.adoc | 2 +-\n>  gpg-interface.c               | 2 +-\n>  2 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/config/gpg.adoc b/Documentation/config/gpg.adoc\n> index 5cf32b179d..240e46c050 100644\n> --- a/Documentation/config/gpg.adoc\n> +++ b/Documentation/config/gpg.adoc\n> @@ -1,5 +1,5 @@\n>  gpg.program::\n> -\tUse this custom program instead of \"`gpg`\" found on `$PATH` when\n> +\tPathname of the program to use instead of \"`gpg`\" when\n>  \tmaking or verifying a PGP signature. The program must support the\n>  \tsame command-line interface as GPG, namely, to verify a detached\n>  \tsignature, \"`gpg --verify $signature - <$file`\" is run, and the\n> diff --git a/gpg-interface.c b/gpg-interface.c\n> index 0896458de5..3dfbc45385 100644\n> --- a/gpg-interface.c\n> +++ b/gpg-interface.c\n> @@ -783,7 +783,7 @@ static int git_gpg_config(const char *var, const char *value,\n>\n>  \tif (fmtname) {\n>  \t\tfmt = get_format_by_name(fmtname);\n> -\t\treturn git_config_string((char **) &fmt->program, var, value);\n> +\t\treturn git_config_pathname((char **) &fmt->program, var, value);\n>  \t}\n>\n>  \treturn 0;\n>\n> base-commit: a30f80fde927d70950b3b4d1820813480968fb0d\n> --\n> 2.50.1\n"},{"id":"522489","messageId":"20250722190922.51183-1-jonas.brandstoetter@gmx.at","threadId":"63781","inReplyTo":"20250711232348.460804-1-jonas.brandstoetter@gmx.at","subject":"[PATCH v2 0/2] gpg-interface: expand gpg.program as a path","fromName":"Jonas Brandstötter","fromEmail":"jonas.brandstoetter@gmx.at","sentAt":"2025-07-22T19:09:20Z","receivedAt":"2025-07-22T19:10:10Z","isPatch":true,"sender":{"key":"jonas.brandstoetter@gmx.at","avatar":"https://avatars.githubusercontent.com/u/37748408?v=4"},"body":"Allows users to specify a custom gpg program in their home directory.\n\nV2 adds test cases for when the gpg program is not set as an absolute path.\nThe test for gpg in a home directory feels a bit wonky to me, because it\nassumes that `~` is an alias for `$HOME` and just overriding that variable\nwith the test directory. But short of creating a user while running the\ntests, this is the best solution I could come up with.\n\nJonas Brandstötter (2):\n  gpg-interface: expand gpg.program as a path\n  t7510: add test cases for non-absolute gpg program\n\n Documentation/config/gpg.adoc |  2 +-\n gpg-interface.c               |  2 +-\n t/t7510-signed-commit.sh      | 12 +++++++++++-\n 3 files changed, 13 insertions(+), 3 deletions(-)\n\nRange-diff against v1:\n1:  b551903c16 = 1:  b551903c16 gpg-interface: expand gpg.program as a path\n-:  ---------- > 2:  ca22bf2ee6 t7510: add test cases for non-absolute gpg program\n--\n2.50.1\n"},{"id":"522490","messageId":"20250722190922.51183-2-jonas.brandstoetter@gmx.at","threadId":"63781","inReplyTo":"20250711232348.460804-1-jonas.brandstoetter@gmx.at","subject":"[PATCH v2 1/2] gpg-interface: expand gpg.program as a path","fromName":"Jonas Brandstötter","fromEmail":"jonas.brandstoetter@gmx.at","sentAt":"2025-07-22T19:09:21Z","receivedAt":"2025-07-22T19:10:20Z","isPatch":true,"sender":{"key":"jonas.brandstoetter@gmx.at","avatar":"https://avatars.githubusercontent.com/u/37748408?v=4"},"body":"This allows using a custom gpg program under the user's home directory\nby specifying a path starting with '~'\n\n[gpg]\n        program = \"~/.local/bin/mygpg\"\n\nSigned-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at>\n---\n Documentation/config/gpg.adoc | 2 +-\n gpg-interface.c               | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config/gpg.adoc b/Documentation/config/gpg.adoc\nindex 5cf32b179d..240e46c050 100644\n--- a/Documentation/config/gpg.adoc\n+++ b/Documentation/config/gpg.adoc\n@@ -1,5 +1,5 @@\n gpg.program::\n-\tUse this custom program instead of \"`gpg`\" found on `$PATH` when\n+\tPathname of the program to use instead of \"`gpg`\" when\n \tmaking or verifying a PGP signature. The program must support the\n \tsame command-line interface as GPG, namely, to verify a detached\n \tsignature, \"`gpg --verify $signature - <$file`\" is run, and the\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 0896458de5..3dfbc45385 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -783,7 +783,7 @@ static int git_gpg_config(const char *var, const char *value,\n \n \tif (fmtname) {\n \t\tfmt = get_format_by_name(fmtname);\n-\t\treturn git_config_string((char **) &fmt->program, var, value);\n+\t\treturn git_config_pathname((char **) &fmt->program, var, value);\n \t}\n \n \treturn 0;\n-- \n2.50.1\n\n"},{"id":"522491","messageId":"20250722190922.51183-3-jonas.brandstoetter@gmx.at","threadId":"63781","inReplyTo":"20250711232348.460804-1-jonas.brandstoetter@gmx.at","subject":"[PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Jonas Brandstötter","fromEmail":"jonas.brandstoetter@gmx.at","sentAt":"2025-07-22T19:09:22Z","receivedAt":"2025-07-22T19:10:31Z","isPatch":true,"sender":{"key":"jonas.brandstoetter@gmx.at","avatar":"https://avatars.githubusercontent.com/u/37748408?v=4"},"body":"These cases cover scenarios where `gpg.program` is set as a program in\n`$PATH` or as a path relative to the user's home directory.\n\nSigned-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at>\n---\n t/t7510-signed-commit.sh | 12 +++++++++++-\n 1 file changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh\nindex 39677e859a..95d2ebe277 100755\n--- a/t/t7510-signed-commit.sh\n+++ b/t/t7510-signed-commit.sh\n@@ -449,7 +449,17 @@ test_expect_success 'custom `gpg.program`' '\n \n \ttest_must_fail env LET_GPG_PROGRAM_FAIL=1 \\\n \tgit commit -S --allow-empty -m must-fail 2>err &&\n-\tgrep zOMG err\n+\tgrep zOMG err &&\n+\n+\t# `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`\n+\ttest_config gpg.program \"~/fake-gpg\" &&\n+\tenv HOME=\"$(pwd)\" \\\n+\tgit commit -S --allow-empty -m signed-commit &&\n+\n+\t# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`\n+\ttest_config gpg.program \"fake-gpg\" &&\n+\tenv PATH=\"$(pwd):$PATH\" \\\n+\tgit commit -S --allow-empty -m signed-commit\n '\n \n test_done\n-- \n2.50.1\n\n"},{"id":"522494","messageId":"xmqqh5z4rmvd.fsf@gitster.g","threadId":"63781","inReplyTo":"20250722190922.51183-1-jonas.brandstoetter@gmx.at","subject":"Re: [PATCH v2 0/2] gpg-interface: expand gpg.program as a path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-22T20:28:38Z","receivedAt":"2025-07-22T20:28:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonas Brandstötter <jonas.brandstoetter@gmx.at> writes:\n\n> Allows users to specify a custom gpg program in their home directory.\n>\n> V2 adds test cases for when the gpg program is not set as an absolute path.\n> The test for gpg in a home directory feels a bit wonky to me, because it\n> assumes that `~` is an alias for `$HOME` and just overriding that variable\n> with the test directory. But short of creating a user while running the\n> tests, this is the best solution I could come up with.\n>\n> Jonas Brandstötter (2):\n>   gpg-interface: expand gpg.program as a path\n>   t7510: add test cases for non-absolute gpg program\n>\n>  Documentation/config/gpg.adoc |  2 +-\n>  gpg-interface.c               |  2 +-\n>  t/t7510-signed-commit.sh      | 12 +++++++++++-\n>  3 files changed, 13 insertions(+), 3 deletions(-)\n>\n> Range-diff against v1:\n> 1:  b551903c16 = 1:  b551903c16 gpg-interface: expand gpg.program as a path\n> -:  ---------- > 2:  ca22bf2ee6 t7510: add test cases for non-absolute gpg program\n> --\n> 2.50.1\n\nThe first iteration of the patch was merged in the 'next' branch\nlong time ago, and then to the 'master' branch already.  It is way\ntoo late to wholesale replace the patch from the previous iteration.\n\nIt appears the first patch hasn't changed at all, so I'll just take\nthe second patch as a separate, follow-up topic to add a missing\ntest for already-graduated topic.\n\nThanks!\n"},{"id":"522713","messageId":"20250725043043.GA3002998@coredump.intra.peff.net","threadId":"63781","inReplyTo":"20250722190922.51183-3-jonas.brandstoetter@gmx.at","subject":"Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-07-25T04:30:43Z","receivedAt":"2025-07-25T04:30:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 22, 2025 at 09:09:22PM +0200, Jonas Brandstötter wrote:\n\n>  \ttest_must_fail env LET_GPG_PROGRAM_FAIL=1 \\\n>  \tgit commit -S --allow-empty -m must-fail 2>err &&\n> -\tgrep zOMG err\n> +\tgrep zOMG err &&\n> +\n> +\t# `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`\n> +\ttest_config gpg.program \"~/fake-gpg\" &&\n> +\tenv HOME=\"$(pwd)\" \\\n> +\tgit commit -S --allow-empty -m signed-commit &&\n> +\n> +\t# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`\n> +\ttest_config gpg.program \"fake-gpg\" &&\n> +\tenv PATH=\"$(pwd):$PATH\" \\\n> +\tgit commit -S --allow-empty -m signed-commit\n\nThis second test seems to fail on Windows. E.g., in this CI job:\n\n  https://github.com/git/git/actions/runs/16509422831/job/46688307091\n\nRight before the failure, the trace shows that we are setting PATH like\nthis:\n\n  ++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'\n\nShould it be \"/d/a/git/git/...\" instead of \"D:/a/git/git/...\"? Which we\ncould get by using $PWD, I think.\n\nThe earlier one using $HOME uses D:/, but this one is different because\ncolons are meaningful separators in $PATH.\n\n-Peff\n"},{"id":"522715","messageId":"20250725051309.GA3003751@coredump.intra.peff.net","threadId":"63781","inReplyTo":"20250725043043.GA3002998@coredump.intra.peff.net","subject":"Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-07-25T05:13:09Z","receivedAt":"2025-07-25T05:13:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jul 25, 2025 at 12:30:43AM -0400, Jeff King wrote:\n\n> This second test seems to fail on Windows. E.g., in this CI job:\n> [...]\n> Should it be \"/d/a/git/git/...\" instead of \"D:/a/git/git/...\"? Which we\n> could get by using $PWD, I think.\n\nYeah, that is it. I found a commit with some prior art, and here is the\npassing CI result:\n\n  https://github.com/peff/git/actions/runs/16513873854\n\n> The earlier one using $HOME uses D:/, but this one is different because\n> colons are meaningful separators in $PATH.\n\nI do wonder if that one needs to set $HOME at all. The test harness\nalready points $HOME to the trash directory. But maybe it has value to\ndocument the expectation.\n\nAnyway, here is the fix as a patch on top of jb/t7510-gpg-program-path.\nI am also happy for it to be squashed in, since I think the topic is not\nyet in 'next'.\n\n-- >8 --\nSubject: [PATCH] t7510: use $PWD instead of $(pwd) inside PATH\n\nOn Windows, $(pwd) will give us a Windows-style path like \"D:/foo\".\nPutting that into $PATH confuses anybody parsing that variable, since\ncolon is a separator character in $PATH. Instead, we should use the\nUnix-style value we get from $PWD (\"/d/foo\").\n\nThis is similar to the cases fixed by 71dd50472d (t0021, t5615: use $PWD\ninstead of $(pwd) in PATH-like shell variables, 2016-11-11).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/t7510-signed-commit.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh\nindex 95d2ebe277..1201c85ba6 100755\n--- a/t/t7510-signed-commit.sh\n+++ b/t/t7510-signed-commit.sh\n@@ -458,7 +458,7 @@ test_expect_success 'custom `gpg.program`' '\n \n \t# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`\n \ttest_config gpg.program \"fake-gpg\" &&\n-\tenv PATH=\"$(pwd):$PATH\" \\\n+\tenv PATH=\"$PWD:$PATH\" \\\n \tgit commit -S --allow-empty -m signed-commit\n '\n \n"},{"id":"522905","messageId":"xmqq5xfbuahx.fsf@gitster.g","threadId":"63781","inReplyTo":"20250725043043.GA3002998@coredump.intra.peff.net","subject":"Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-29T00:05:46Z","receivedAt":"2025-07-29T00:05:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> This second test seems to fail on Windows. E.g., in this CI job:\n>\n>   https://github.com/git/git/actions/runs/16509422831/job/46688307091\n>\n> Right before the failure, the trace shows that we are setting PATH like\n> this:\n>\n>   ++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'\n>\n> Should it be \"/d/a/git/git/...\" instead of \"D:/a/git/git/...\"? Which we\n> could get by using $PWD, I think.\n>\n> The earlier one using $HOME uses D:/, but this one is different because\n> colons are meaningful separators in $PATH.\n\nHere is what I have on top of the posted patches.  If today's\nintegration goes well, I plan to merge it to 'next'; the rest of the\nseries is already in 'next'.\n\n---- >8 ----\nSubject: [PATCH] t7510: Windows fix\n\n$PATH and $(pwd) does not mix very well, because PATH is a colon\nseparated list of directories, but on Windows port of the shell\nGit-for-Windows uses, $(pwd) looks like \"D:/path/to/a/directory\".\n\nWith $PWD, we would get /d/path/to/a/directory instead, which would\nfit better on $PATH.  This broke Windows CI job.\n\nWhile at it, drop unnecessary use of \"env VAR=VAL\" before \"git\ncommit\"; one-shot export \"VAR=VAL git commit\" is sufficient.\n\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t7510-signed-commit.sh | 6 ++----\n 1 file changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh\nindex 95d2ebe277..c51e2e2589 100755\n--- a/t/t7510-signed-commit.sh\n+++ b/t/t7510-signed-commit.sh\n@@ -453,13 +453,11 @@ test_expect_success 'custom `gpg.program`' '\n \n \t# `gpg.program` starts with `~`, the path should be interpreted to be relative to `$HOME`\n \ttest_config gpg.program \"~/fake-gpg\" &&\n-\tenv HOME=\"$(pwd)\" \\\n-\tgit commit -S --allow-empty -m signed-commit &&\n+\tHOME=\"$(pwd)\" git commit -S --allow-empty -m signed-commit &&\n \n \t# `gpg.program` does not specify an absolute path, it should find a program in `$PATH`\n \ttest_config gpg.program \"fake-gpg\" &&\n-\tenv PATH=\"$(pwd):$PATH\" \\\n-\tgit commit -S --allow-empty -m signed-commit\n+\tPATH=\"$PWD:$PATH\" git commit -S --allow-empty -m signed-commit\n '\n \n test_done\n-- \n2.50.1-589-gf1cdebda82\n\n"},{"id":"522925","messageId":"20250729071247.GA1426859@coredump.intra.peff.net","threadId":"63781","inReplyTo":"xmqq5xfbuahx.fsf@gitster.g","subject":"Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-07-29T07:12:47Z","receivedAt":"2025-07-29T07:12:56Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 28, 2025 at 05:05:46PM -0700, Junio C Hamano wrote:\n\n> > Should it be \"/d/a/git/git/...\" instead of \"D:/a/git/git/...\"? Which we\n> > could get by using $PWD, I think.\n> >\n> > The earlier one using $HOME uses D:/, but this one is different because\n> > colons are meaningful separators in $PATH.\n> \n> Here is what I have on top of the posted patches.  If today's\n> integration goes well, I plan to merge it to 'next'; the rest of the\n> series is already in 'next'.\n\nLooks good. Not sure if you saw the patch I posted in this thread. It's\nroughly the same as yours, though I didn't drop the useless \"env\" (which\nI agree is useless).\n\nI did reference 71dd50472d (t0021, t5615: use $PWD instead of $(pwd) in\nPATH-like shell variables, 2016-11-11) to try to give more explanation\nof the two different sources. But re-reading it, it actually doesn't\nreally clarify much. ;) So maybe not worth worrying about.\n\n-Peff\n"},{"id":"522964","messageId":"xmqqms8nqboj.fsf@gitster.g","threadId":"63781","inReplyTo":"20250729071247.GA1426859@coredump.intra.peff.net","subject":"Re: [PATCH v2 2/2] t7510: add test cases for non-absolute gpg program","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-29T15:06:04Z","receivedAt":"2025-07-29T15:06:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Jul 28, 2025 at 05:05:46PM -0700, Junio C Hamano wrote:\n>\n>> > Should it be \"/d/a/git/git/...\" instead of \"D:/a/git/git/...\"? Which we\n>> > could get by using $PWD, I think.\n>> >\n>> > The earlier one using $HOME uses D:/, but this one is different because\n>> > colons are meaningful separators in $PATH.\n>> \n>> Here is what I have on top of the posted patches.  If today's\n>> integration goes well, I plan to merge it to 'next'; the rest of the\n>> series is already in 'next'.\n>\n> Looks good. Not sure if you saw the patch I posted in this thread. It's\n> roughly the same as yours, though I didn't drop the useless \"env\" (which\n> I agree is useless).\n\nAh, sorry, no I missed it.  Will replace with your variant.\n\n> I did reference 71dd50472d (t0021, t5615: use $PWD instead of $(pwd) in\n> PATH-like shell variables, 2016-11-11) to try to give more explanation\n> of the two different sources. But re-reading it, it actually doesn't\n> really clarify much. ;) So maybe not worth worrying about.\n>\n> -Peff\n\nThanks.\n"}]}