config: make git_config_include() static

It is not used from outside the file in which it is declared. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Acked-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed Jan 18, 2022 at 09:47 UTC ed69e11b89af41c112ab80f5278a2b29c6f5f5b3
2 files changed +15 -34
config.c
+11 -1
@@ -120,6 +120,16 @@ static long config_buf_ftell(struct config_source *conf)
120 return conf->u.buf.pos;
121 }
122
123 +struct config_include_data {
124 + int depth;
125 + config_fn_t fn;
126 + void *data;
127 + const struct config_options *opts;
128 +};
129 +#define CONFIG_INCLUDE_INIT { 0 }
130 +
131 +static int git_config_include(const char *var, const char *value, void *data);
132 +
133 #define MAX_INCLUDE_DEPTH 10
134 static const char include_depth_advice[] = N_(
135 "exceeded maximum include depth (%d) while including\n"
@@ -309,7 +319,7 @@ static int include_condition_is_true(const struct config_options *opts,
319 return 0;
320 }
321
312 -int git_config_include(const char *var, const char *value, void *data)
322 +static int git_config_include(const char *var, const char *value, void *data)
323 {
324 struct config_include_data *inc = data;
325 const char *cond, *key;
config.h
+4 -33
@@ -126,6 +126,8 @@ int git_default_config(const char *, const char *, void *);
126 /**
127 * Read a specific file in git-config format.
128 * This function takes the same callback and data parameters as `git_config`.
129 + *
130 + * Unlike git_config(), this function does not respect includes.
131 */
132 int git_config_from_file(config_fn_t fn, const char *, void *);
133
@@ -158,6 +160,8 @@ void read_very_early_config(config_fn_t cb, void *data);
160 * will first feed the user-wide one to the callback, and then the
161 * repo-specific one; by overwriting, the higher-priority repo-specific
162 * value is left at the end).
163 + *
164 + * Unlike git_config_from_file(), this function respects includes.
165 */
166 void git_config(config_fn_t fn, void *);
167
@@ -338,39 +342,6 @@ const char *current_config_origin_type(void);
342 const char *current_config_name(void);
343 int current_config_line(void);
344
341 -/**
342 - * Include Directives
343 - * ------------------
344 - *
345 - * By default, the config parser does not respect include directives.
346 - * However, a caller can use the special `git_config_include` wrapper
347 - * callback to support them. To do so, you simply wrap your "real" callback
348 - * function and data pointer in a `struct config_include_data`, and pass
349 - * the wrapper to the regular config-reading functions. For example:
350 - *
351 - * -------------------------------------------
352 - * int read_file_with_include(const char *file, config_fn_t fn, void *data)
353 - * {
354 - * struct config_include_data inc = CONFIG_INCLUDE_INIT;
355 - * inc.fn = fn;
356 - * inc.data = data;
357 - * return git_config_from_file(git_config_include, file, &inc);
358 - * }
359 - * -------------------------------------------
360 - *
361 - * `git_config` respects includes automatically. The lower-level
362 - * `git_config_from_file` does not.
363 - *
364 - */
365 -struct config_include_data {
366 - int depth;
367 - config_fn_t fn;
368 - void *data;
369 - const struct config_options *opts;
370 -};
371 -#define CONFIG_INCLUDE_INIT { 0 }
372 -int git_config_include(const char *name, const char *value, void *data);
373 -
345 /*
346 * Match and parse a config key of the form:
347 *