]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/fmt-merge-msg.c
merge: Make 'merge.log' an integer or boolean option
[thirdparty/git.git] / builtin / fmt-merge-msg.c
index 455e7c67f885e7a8584066fca6f759ddd27443db..d2eed43ab5c165f3b0ed10ba3df4296fc4679dd2 100644 (file)
@@ -15,15 +15,13 @@ static int shortlog_len;
 
 static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
 {
-       static int found_merge_log = 0;
-       if (!strcmp("merge.log", key)) {
-               found_merge_log = 1;
-               shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;
-               return 0;
-       }
-       if (!found_merge_log && !strcmp("merge.summary", key)) {
-               shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;
-               return 0;
+       if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
+               int is_bool;
+               shortlog_len = git_config_bool_or_int(key, value, &is_bool);
+               if (!is_bool && shortlog_len < 0)
+                       return error("%s: negative length %s", key, value);
+               if (is_bool && shortlog_len)
+                       shortlog_len = DEFAULT_MERGE_LOG_LEN;
        }
        return 0;
 }