Skip to content

Commit b20f49d

Browse files
derrickstoleegitster
authored andcommitted
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>
1 parent 67ad421 commit b20f49d

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

builtin/config.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -231,30 +231,6 @@ static void show_config_scope(const struct config_display_options *opts,
231231
strbuf_addch(buf, term);
232232
}
233233

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-
258234
struct strbuf_list {
259235
struct strbuf *items;
260236
int nr;
@@ -332,6 +308,30 @@ static int format_config(const struct config_display_options *opts,
332308
return 0;
333309
}
334310

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+
335335
#define GET_VALUE_ALL (1 << 0)
336336
#define GET_VALUE_KEY_REGEXP (1 << 1)
337337

0 commit comments

Comments
 (0)