When other builtins call merge_recursive(), they would have to handle the GIT_MERGE_VERBOSITY environment variable, causing a code duplication. Same story for the git_config() call. It's better to do it when merge_recursive() is called the first time. Signed-off-by: Miklos Vajna <vmiklos@xxxxxxxxxxxxxx> --- builtin-merge-recursive.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c index 43e55bf..09aa830 100644 --- a/builtin-merge-recursive.c +++ b/builtin-merge-recursive.c @@ -1218,6 +1218,8 @@ static struct commit_list *reverse_commit_list(struct commit_list *list) return next; } +static int merge_config(const char *var, const char *value, void *cb); + /* * Merge the commits h1 and h2, return the resulting virtual * commit object and a flag indicating the cleanness of the merge. @@ -1233,6 +1235,17 @@ int merge_recursive(struct commit *h1, struct commit *merged_common_ancestors; struct tree *mrtree = mrtree; int clean; + static int initial = 1; + + if (initial) { + git_config(merge_config, NULL); + if (getenv("GIT_MERGE_VERBOSITY")) + verbosity = strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10); + if (verbosity >= 5) + buffer_output = 0; + + initial = 0; + } if (show(4)) { output(4, "Merging:"); @@ -1369,10 +1382,6 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) subtree_merge = 1; } - git_config(merge_config, NULL); - if (getenv("GIT_MERGE_VERBOSITY")) - verbosity = strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10); - if (argc < 4) die("Usage: %s <base>... -- <head> <remote> ...\n", argv[0]); @@ -1384,8 +1393,6 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix) } if (argc - i != 3) /* "--" "<head>" "<remote>" */ die("Not handling anything other than two heads merge."); - if (verbosity >= 5) - buffer_output = 0; branch1 = argv[++i]; branch2 = argv[++i]; -- 1.6.0.rc0.14.g95f8.dirty -- 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