Re: [PATCH v2 04/13] config: format int64s gently
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 17, 2026, 09:05 UTC
- Message-ID
- <aZQvP21anXXZWcMh@pks.im>
- In-Reply-To
- <2bca4d231686e33ea9d4d85b10fcffd60a63ad46.1771026918.git.gitgitgadget@gmail.com>
On Fri, Feb 13, 2026 at 11:55:09PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 11 quoted lines
> diff --git a/builtin/config.c b/builtin/config.c
> index 4c4c791883..d259a91d53 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -237,6 +237,25 @@ struct strbuf_list {
> int alloc;
> };
>
> +static int format_config_int64(struct strbuf *buf,
> + const char *key_,
> + const char *value_,Why do we have the trailing underscores here?
Show 28 quoted lines
> @@ -249,8 +268,9 @@ struct strbuf_list {
> static int format_config(const struct config_display_options *opts,
> struct strbuf *buf, const char *key_,
> const char *value_, const struct key_value_info *kvi,
> - int gently UNUSED)
> + int gently)
> {
> + int res = 0;
> if (opts->show_scope)
> show_config_scope(opts, kvi, buf);
> if (opts->show_origin)
> @@ -262,8 +282,7 @@ static int format_config(const struct config_display_options *opts,
> strbuf_addch(buf, opts->key_delim);
>
> if (opts->type == TYPE_INT)
> - strbuf_addf(buf, "%"PRId64,
> - git_config_int64(key_, value_ ? value_ : "", kvi));
> + res = format_config_int64(buf, key_, value_, kvi, gently);
> else if (opts->type == TYPE_BOOL)
> strbuf_addstr(buf, git_config_bool(key_, value_) ?
> "true" : "false");
> @@ -309,7 +328,7 @@ static int format_config(const struct config_display_options *opts,
> }
> }
> strbuf_addch(buf, opts->term);
> - return 0;
> + return res;
> }Okay. We bubble up the return value now, but we know that the return value will only be different in case `gently != 0`. Otherwise, any error would cause us to die.
Patrick