merge: --log appends shortlog to message if specified

When the user specifies a message, use fmt_merge_msg_shortlog() to
append the shortlog.

Previously, when a message was specified, we ignored the merge title
("Merge <foo> into <bar>") and shortlog from fmt_merge_msg().

Update the documentation for -m to reflect this too.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Tay Ray Chuan
2010-05-11 01:17:52 +08:00
committed by Junio C Hamano
parent 8c6bdfdf8b
commit f0ecac2b70
4 changed files with 21 additions and 9 deletions

View File

@ -981,18 +981,22 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
/*
* All the rest are the commits being merged;
* prepare the standard merge summary message to
* used as the merge message. If remote
* be appended to the given message. If remote
* is invalid we will die later in the common
* codepath so we discard the error in this
* loop.
*/
if (!have_message) {
for (i = 0; i < argc; i++)
merge_name(argv[i], &merge_names);
for (i = 0; i < argc; i++)
merge_name(argv[i], &merge_names);
if (have_message && option_log)
fmt_merge_msg_shortlog(&merge_names, &merge_msg);
else if (!have_message)
fmt_merge_msg(option_log, &merge_names, &merge_msg);
if (merge_msg.len)
strbuf_setlen(&merge_msg, merge_msg.len-1);
}
if (!(have_message && !option_log) && merge_msg.len)
strbuf_setlen(&merge_msg, merge_msg.len-1);
}
if (head_invalid || !argc)