merge: Make '--log' an integer option for number of shortlog entries
Change the command-line '--log' option from a boolean option to an integer option, and parse the optional integer provided on the command-line into the 'shortlog_len' variable. Also update the documentation accordingly. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reported-by: Yaroslav Halchenko <debian@onerussian.com> Thanks-to: Jonathan Nieder <jrnieder@gmail.com> Thanks-to: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
1876166aaa
commit
96e9420cd3
@ -42,7 +42,7 @@ static const char * const builtin_merge_usage[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static int show_diffstat = 1, option_log, squash;
|
||||
static int show_diffstat = 1, shortlog_len, squash;
|
||||
static int option_commit = 1, allow_fast_forward = 1;
|
||||
static int fast_forward_only;
|
||||
static int allow_trivial = 1, have_message;
|
||||
@ -175,8 +175,9 @@ static struct option builtin_merge_options[] = {
|
||||
OPT_BOOLEAN(0, "stat", &show_diffstat,
|
||||
"show a diffstat at the end of the merge"),
|
||||
OPT_BOOLEAN(0, "summary", &show_diffstat, "(synonym to --stat)"),
|
||||
OPT_BOOLEAN(0, "log", &option_log,
|
||||
"add list of one-line log to merge commit message"),
|
||||
{ OPTION_INTEGER, 0, "log", &shortlog_len, "n",
|
||||
"add (at most <n>) entries from shortlog to merge commit message",
|
||||
PARSE_OPT_OPTARG, NULL, DEFAULT_MERGE_LOG_LEN },
|
||||
OPT_BOOLEAN(0, "squash", &squash,
|
||||
"create a single commit instead of doing a merge"),
|
||||
OPT_BOOLEAN(0, "commit", &option_commit,
|
||||
@ -501,8 +502,10 @@ static int git_merge_config(const char *k, const char *v, void *cb)
|
||||
return git_config_string(&pull_twohead, k, v);
|
||||
else if (!strcmp(k, "pull.octopus"))
|
||||
return git_config_string(&pull_octopus, k, v);
|
||||
else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary"))
|
||||
option_log = git_config_bool(k, v);
|
||||
else if (!strcmp(k, "merge.log") || !strcmp(k, "merge.summary")) {
|
||||
shortlog_len = git_config_bool(k, v) ? DEFAULT_MERGE_LOG_LEN : 0;
|
||||
return 0;
|
||||
}
|
||||
return git_diff_ui_config(k, v, cb);
|
||||
}
|
||||
|
||||
@ -998,9 +1001,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
for (i = 0; i < argc; i++)
|
||||
merge_name(argv[i], &merge_names);
|
||||
|
||||
if (!have_message || option_log) {
|
||||
if (!have_message || shortlog_len) {
|
||||
fmt_merge_msg(&merge_names, &merge_msg, !have_message,
|
||||
option_log ? DEFAULT_MERGE_LOG_LEN : 0);
|
||||
shortlog_len);
|
||||
if (merge_msg.len)
|
||||
strbuf_setlen(&merge_msg, merge_msg.len - 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user