config: move show_all_config()
In anticipation of using format_config() in this method, move show_all_config() lower in the file without changes. 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
25ede48b5406524d1a6b900e400f593c0b9a34dd
1 file changed
+24
-24
builtin/config.c
+24
-24
@@ -231,30 +231,6 @@ static void show_config_scope(const struct config_display_options *opts,
231
strbuf_addch(buf, term);
232
}
233
234
-static int show_all_config(const char *key_, const char *value_,
235
- const struct config_context *ctx,
236
- void *cb)
237
-{
238
- const struct config_display_options *opts = cb;
239
- const struct key_value_info *kvi = ctx->kvi;
240
-
241
- if (opts->show_origin || opts->show_scope) {
242
- struct strbuf buf = STRBUF_INIT;
243
- if (opts->show_scope)
244
- show_config_scope(opts, kvi, &buf);
245
- if (opts->show_origin)
246
- show_config_origin(opts, kvi, &buf);
247
- /* Use fwrite as "buf" can contain \0's if "end_null" is set. */
248
- fwrite(buf.buf, 1, buf.len, stdout);
249
- strbuf_release(&buf);
250
- }
251
- if (!opts->omit_values && value_)
252
- printf("%s%c%s%c", key_, opts->delim, value_, opts->term);
253
- else
254
- printf("%s%c", key_, opts->term);
255
- return 0;
256
-}
257
-
234
struct strbuf_list {
235
struct strbuf *items;
236
int nr;
@@ -332,6 +308,30 @@ static int format_config(const struct config_display_options *opts,
308
return 0;
309
}
310
311
+static int show_all_config(const char *key_, const char *value_,
312
+ const struct config_context *ctx,
313
+ void *cb)
314
+{
315
+ const struct config_display_options *opts = cb;
316
+ const struct key_value_info *kvi = ctx->kvi;
317
+
318
+ if (opts->show_origin || opts->show_scope) {
319
+ struct strbuf buf = STRBUF_INIT;
320
+ if (opts->show_scope)
321
+ show_config_scope(opts, kvi, &buf);
322
+ if (opts->show_origin)
323
+ show_config_origin(opts, kvi, &buf);
324
+ /* Use fwrite as "buf" can contain \0's if "end_null" is set. */
325
+ fwrite(buf.buf, 1, buf.len, stdout);
326
+ strbuf_release(&buf);
327
+ }
328
+ if (!opts->omit_values && value_)
329
+ printf("%s%c%s%c", key_, opts->delim, value_, opts->term);
330
+ else
331
+ printf("%s%c", key_, opts->term);
332
+ return 0;
333
+}
334
+
335
#define GET_VALUE_ALL (1 << 0)
336
#define GET_VALUE_KEY_REGEXP (1 << 1)
337