merge-recursive: check GIT_MERGE_VERBOSITY only 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>
Andrey Okoshkin committed
Oct 31, 2017 at 12:09 UTC
804862209bcbc29f2e7850ecf29f17c1c1aaae6e
1 file changed
+4
-3
merge-recursive.c
+4
-3
@@ -2162,6 +2162,7 @@ static void merge_recursive_config(struct merge_options *o)
2162
2163
void init_merge_options(struct merge_options *o)
2164
{
2165
+ const char *merge_verbosity;
2166
memset(o, 0, sizeof(struct merge_options));
2167
o->verbosity = 2;
2168
o->buffer_output = 1;
@@ -2170,9 +2171,9 @@ void init_merge_options(struct merge_options *o)
2171
o->renormalize = 0;
2172
o->detect_rename = 1;
2173
merge_recursive_config(o);
2173
- if (getenv("GIT_MERGE_VERBOSITY"))
2174
- o->verbosity =
2175
- strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
2174
+ merge_verbosity = getenv("GIT_MERGE_VERBOSITY");
2175
+ if (merge_verbosity)
2176
+ o->verbosity = strtol(merge_verbosity, NULL, 10);
2177
if (o->verbosity >= 5)
2178
o->buffer_output = 0;
2179
strbuf_init(&o->obuf, 0);