Subject: Re: [PATCH v2 09/13] config: format paths gently

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 17 Feb 2026 10:05:14 +0100

On Fri, Feb 13, 2026 at 11:55:14PM +0000, Derrick Stolee via GitGitGadget wrote:
> diff --git a/builtin/config.c b/builtin/config.c
> index 0c539ff98e..4664651dd2 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -314,6 +314,28 @@ static int format_config_bool_or_str(struct strbuf *buf,
>  	return 0;
>  }
>  
> +static int format_config_path(struct strbuf *buf,
> +			      const char *key_,
> +			      const char *value_,
> +			      int gently)
> +{
> +	char *v;
> +	if (gently) {
> +		if (git_parse_maybe_pathname(value_, &v) < 0)
> +			return -1;
> +	} else if (git_config_pathname(&v, key_, value_) < 0) {
> +		return -1;
> +	}
> +
> +	if (v)
> +		strbuf_addstr(buf, v);
> +	else
> +		return 1; /* :(optional)no-such-file */

Okay, this is the first callsite where we return a vaule `> 0`, if I see
correctly. But in `show_all_config()` we check for `res >= 0`, and if so
we would print the configuration regardless.

But `buf` will now be an empty string. So wouldn't this cause us to
print such an empty string, too? I'm not quite sure whether this
behaviour is intentional or not, or whether I'm missing something here.

In any case, I think this should be documented in the commit message.

Patrick