The only entry point into the trailer.c code is process_trailers, which initializes itself by reading the trailer config. Let's pull that out into a separate function and protect it with a lazy-initialization flag. That will let us easily add new entry points in future patches. Signed-off-by: Jeff King <peff@xxxxxxxx> --- trailer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/trailer.c b/trailer.c index 6f3416f..18bf209 100644 --- a/trailer.c +++ b/trailer.c @@ -842,6 +842,19 @@ static void free_all(struct trailer_item **first) } } +static void init_trailer_config(void) +{ + static int initialized; + + if (initialized) + return; + + git_config(git_trailer_default_config, NULL); + git_config(git_trailer_config, NULL); + + initialized = 1; +} + void process_trailers(const char *file, int trim_empty, struct string_list *trailers) { struct trailer_item *in_tok_first = NULL; @@ -850,10 +863,7 @@ void process_trailers(const char *file, int trim_empty, struct string_list *trai struct strbuf **lines; int trailer_end; - /* Default config must be setup first */ - git_config(git_trailer_default_config, NULL); - git_config(git_trailer_config, NULL); - + init_trailer_config(); lines = read_input_file(file); /* Print the lines before the trailers */ -- 2.7.0.rc3.367.g09631da -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html