config: add 'gently' parameter to format_config()
This parameter is set to 0 for all current callers and is UNUSED. However, we will start using this option in future changes and in a critical change that requires gentle parsing (not using die()) to try parsing all values in a list. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Feb 23, 2026 at 12:26 UTC
12210d034635e6e558f23505ef3edaedd870097e
1 file changed
+8
-4
builtin/config.c
+8
-4
@@ -242,10 +242,14 @@ struct strbuf_list {
242
* append it into strbuf `buf`. Returns a negative value on failure,
243
* 0 on success, 1 on a missing optional value (i.e., telling the
244
* caller to pretend that <key_,value_> did not exist).
245
+ *
246
+ * Note: 'gently' is currently ignored, but will be implemented in
247
+ * a future change.
248
*/
249
static int format_config(const struct config_display_options *opts,
250
struct strbuf *buf, const char *key_,
248
- const char *value_, const struct key_value_info *kvi)
251
+ const char *value_, const struct key_value_info *kvi,
252
+ int gently UNUSED)
253
{
254
if (opts->show_scope)
255
show_config_scope(opts, kvi, buf);
@@ -372,7 +376,7 @@ static int collect_config(const char *key_, const char *value_,
376
strbuf_init(&values->items[values->nr], 0);
377
378
status = format_config(data->display_opts, &values->items[values->nr++],
375
- key_, value_, kvi);
379
+ key_, value_, kvi, 0);
380
if (status < 0)
381
return status;
382
if (status) {
@@ -463,7 +467,7 @@ static int get_value(const struct config_location_options *opts,
467
strbuf_init(item, 0);
468
469
status = format_config(display_opts, item, key_,
466
- display_opts->default_value, &kvi);
470
+ display_opts->default_value, &kvi, 0);
471
if (status < 0)
472
die(_("failed to format default config value: %s"),
473
display_opts->default_value);
@@ -743,7 +747,7 @@ static int get_urlmatch(const struct config_location_options *opts,
747
748
status = format_config(&display_opts, &buf, item->string,
749
matched->value_is_null ? NULL : matched->value.buf,
746
- &matched->kvi);
750
+ &matched->kvi, 0);
751
if (!status)
752
fwrite(buf.buf, 1, buf.len, stdout);
753
strbuf_release(&buf);