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

Re: [PATCH] gpg-interface: expand gpg.program as a path

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 14, 2025, 17:10 UTC
Message-ID
<xmqqy0sqsnor.fsf@gitster.g>
In-Reply-To
<20250711232348.460804-1-jonas.brandstoetter@gmx.at>
Jonas Brandstötter <jonas.brandstoetter@gmx.at> writes:
Show 10 quoted lines
> This allows using a custom gpg program under the user's home directory
> by specifying a path starting with '~'
>
> [gpg]
>         program = "~/.local/bin/mygpg"
>
> Signed-off-by: Jonas Brandstötter <jonas.brandstoetter@gmx.at>
> ---
> First time interacting with a project via a mailing list. Do let me know if
> I did something very dumb.

Thanks. The update to the codumentation to explicitly say that the variable is about "pathname" is a very nice touch, and the code change is trivially correct, I guess.

I wonder if we can have some test to protect this feature from broken by mistake, though.

Show 32 quoted lines
>  Documentation/config/gpg.adoc | 2 +-
>  gpg-interface.c               | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config/gpg.adoc b/Documentation/config/gpg.adoc
> index 5cf32b179d..240e46c050 100644
> --- a/Documentation/config/gpg.adoc
> +++ b/Documentation/config/gpg.adoc
> @@ -1,5 +1,5 @@
>  gpg.program::
> -	Use this custom program instead of "`gpg`" found on `$PATH` when
> +	Pathname of the program to use instead of "`gpg`" when
>  	making or verifying a PGP signature. The program must support the
>  	same command-line interface as GPG, namely, to verify a detached
>  	signature, "`gpg --verify $signature - <$file`" is run, and the
> diff --git a/gpg-interface.c b/gpg-interface.c
> index 0896458de5..3dfbc45385 100644
> --- a/gpg-interface.c
> +++ b/gpg-interface.c
> @@ -783,7 +783,7 @@ static int git_gpg_config(const char *var, const char *value,
>
>  	if (fmtname) {
>  		fmt = get_format_by_name(fmtname);
> -		return git_config_string((char **) &fmt->program, var, value);
> +		return git_config_pathname((char **) &fmt->program, var, value);
>  	}
>
>  	return 0;
>
> base-commit: a30f80fde927d70950b3b4d1820813480968fb0d
> --
> 2.50.1
Previous: Jonas BrandstötterNext: Jonas Brandstötter
Message 3 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.