summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fmt-merge-msg.c16
-rw-r--r--builtin/merge.c7
2 files changed, 13 insertions, 10 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 455e7c67f8..d2eed43ab5 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -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;
}
diff --git a/builtin/merge.c b/builtin/merge.c
index 9e4733d25f..1e9c898aec 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -503,7 +503,12 @@ static int git_merge_config(const char *k, const char *v, void *cb)
else if (!strcmp(k, "pull.octopus"))
return git_config_string(&pull_octopus, k, v);
else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) {
- shortlog_len = git_config_bool(k, v) ? DEFAULT_MERGE_LOG_LEN : 0;
+ int is_bool;
+ shortlog_len = git_config_bool_or_int(k, v, &is_bool);
+ if (!is_bool && shortlog_len < 0)
+ return error("%s: negative length %s", k, v);
+ if (is_bool && shortlog_len)
+ shortlog_len = DEFAULT_MERGE_LOG_LEN;
return 0;
}
return git_diff_ui_config(k, v, cb);