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

From: Junio C Hamano <[email-masked]>
Date: Mon, 14 Jul 2025 10:10:44 -0700

Jonas Brandstötter <[email-masked]> writes:

> 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 <[email-masked]>
> ---
> 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.

>  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