summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8c6bdfd)
raw | patch | inline | side by side (parent: 8c6bdfd)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Mon, 10 May 2010 17:17:52 +0000 (01:17 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 10 May 2010 19:02:20 +0000 (12:02 -0700) |
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>
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>
Documentation/git-merge.txt | patch | blob | history | |
builtin/fmt-merge-msg.c | patch | blob | history | |
builtin/merge.c | patch | blob | history | |
t/t7604-merge-custom-message.sh | patch | blob | history |
index c2325ef90e336a37df42eb7f71f95e3581c83127..84043cc5b26db7d34c93a70ec005df913c345d85 100644 (file)
-m <msg>::
Set the commit message to be used for the merge commit (in
- case one is created). The 'git fmt-merge-msg' command can be
+ case one is created).
+
+ If `--log` is specified, a shortlog of the commits being merged
+ will be appended to the specified message.
+
+ The 'git fmt-merge-msg' command can be
used to give a good default for automated 'git merge'
invocations.
index 48548cf11badaae6b34bfc4140164dde0dc10123..44204257c72afd3a6a24966b9a11cf9f2374e9ce 100644 (file)
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
rev.ignore_merges = 1;
rev.limited = 1;
+ if (suffixcmp(out->buf, "\n"))
+ strbuf_addch(out, '\n');
+
for (i = 0; i < origins.nr; i++)
shortlog(origins.items[i].string, origins.items[i].util,
head, &rev, limit, out);
diff --git a/builtin/merge.c b/builtin/merge.c
index 0ae480987ac4d97af437e27a9e4d6b8e4ecf4211..cae1cbee26535635cfe0d7e3a6f98e3a36e94cf7 100644 (file)
--- a/builtin/merge.c
+++ b/builtin/merge.c
/*
* 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)
index af53df1c1b0773133dd9883492e286898e60a0c6..9114785ef7c850ae2d393bed3565e13f11339ba0 100755 (executable)
test_cmp exp.subject actual
'
-test_expect_failure 'merge --log appends to custom message' '
+test_expect_success 'merge --log appends to custom message' '
git reset --hard c1 &&
git merge --log -m "$(cat exp.subject)" c2 &&
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&