diff options
author | Andrey Okoshkin <a.okoshkin@samsung.com> | 2017-10-31 12:09:13 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-01 10:11:56 +0900 |
commit | 804862209bcbc29f2e7850ecf29f17c1c1aaae6e (patch) | |
tree | 45d4148b8a79bdaf458779035feb8ae1a934b2f2 | |
parent | 42e6fde5c28150206956ea4be490d886c4ecbd68 (diff) | |
download | git-804862209bcbc29f2e7850ecf29f17c1c1aaae6e.tar.gz |
merge-recursive: check GIT_MERGE_VERBOSITY only onceao/merge-verbosity-getenv-just-once
Get rid of the duplicated getenv('GIT_MERGE_VERBOSITY') calls with the same
constant string argument. This makes code more readable and prevents typo in
the further development.
Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | merge-recursive.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 7a7d55aabe..6b3109e3a4 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -2162,6 +2162,7 @@ static void merge_recursive_config(struct merge_options *o) void init_merge_options(struct merge_options *o) { + const char *merge_verbosity; memset(o, 0, sizeof(struct merge_options)); o->verbosity = 2; o->buffer_output = 1; @@ -2170,9 +2171,9 @@ void init_merge_options(struct merge_options *o) o->renormalize = 0; o->detect_rename = 1; merge_recursive_config(o); - if (getenv("GIT_MERGE_VERBOSITY")) - o->verbosity = - strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10); + merge_verbosity = getenv("GIT_MERGE_VERBOSITY"); + if (merge_verbosity) + o->verbosity = strtol(merge_verbosity, NULL, 10); if (o->verbosity >= 5) o->buffer_output = 0; strbuf_init(&o->obuf, 0); |