提交 bda3b8ff 编写于 作者: R Ramkumar Ramachandra 提交者: Junio C Hamano

merge: Make 'merge.log' an integer or boolean option

Make 'merge.log' an integer or boolean option to set the number of
shortlog entries to display in the merge commit. Note that it defaults
to false, and that true means a default value of 20. Also update
corresponding documentation.
Signed-off-by: NRamkumar Ramachandra <artagnon@gmail.com>
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 96e9420c
...@@ -54,8 +54,10 @@ CONFIGURATION ...@@ -54,8 +54,10 @@ CONFIGURATION
------------- -------------
merge.log:: merge.log::
Whether to include summaries of merged commits in newly In addition to branch names, populate the log message with at
merge commit messages. False by default. most the specified number of one-line descriptions from the
actual commits that are being merged. Defaults to false, and
true is a synoym for 20.
merge.summary:: merge.summary::
Synonym to `merge.log`; this is deprecated and will be removed in Synonym to `merge.log`; this is deprecated and will be removed in
......
...@@ -7,8 +7,10 @@ merge.conflictstyle:: ...@@ -7,8 +7,10 @@ merge.conflictstyle::
marker and the original text before the `=======` marker. marker and the original text before the `=======` marker.
merge.log:: merge.log::
Whether to include summaries of merged commits in newly created In addition to branch names, populate the log message with at
merge commit messages. False by default. most the specified number of one-line descriptions from the
actual commits that are being merged. Defaults to false, and
true is a synoym for 20.
merge.renameLimit:: merge.renameLimit::
The number of files to consider when performing rename detection The number of files to consider when performing rename detection
......
...@@ -15,15 +15,13 @@ static int shortlog_len; ...@@ -15,15 +15,13 @@ static int shortlog_len;
static int fmt_merge_msg_config(const char *key, const char *value, void *cb) static int fmt_merge_msg_config(const char *key, const char *value, void *cb)
{ {
static int found_merge_log = 0; if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
if (!strcmp("merge.log", key)) { int is_bool;
found_merge_log = 1; shortlog_len = git_config_bool_or_int(key, value, &is_bool);
shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0; if (!is_bool && shortlog_len < 0)
return 0; return error("%s: negative length %s", key, value);
} if (is_bool && shortlog_len)
if (!found_merge_log && !strcmp("merge.summary", key)) { shortlog_len = DEFAULT_MERGE_LOG_LEN;
shortlog_len = git_config_bool(key, value) ? DEFAULT_MERGE_LOG_LEN : 0;
return 0;
} }
return 0; return 0;
} }
......
...@@ -503,7 +503,12 @@ static int git_merge_config(const char *k, const char *v, void *cb) ...@@ -503,7 +503,12 @@ static int git_merge_config(const char *k, const char *v, void *cb)
else if (!strcmp(k, "pull.octopus")) else if (!strcmp(k, "pull.octopus"))
return git_config_string(&pull_octopus, k, v); return git_config_string(&pull_octopus, k, v);
else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) { 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 0;
} }
return git_diff_ui_config(k, v, cb); return git_diff_ui_config(k, v, cb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册