aboutsummaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-06-18 11:16:54 -0700
committerJunio C Hamano <gitster@pobox.com>2010-06-18 11:16:54 -0700
commit8642abc76454a6e09344e27a7797ff08264abe76 (patch)
treedcdc99515cb5e53795b7777b85b8030fd1f9fbb4 /builtin/merge.c
parentfd8b005c0d5bcc91c3b5a883f72addc0e51fb38b (diff)
parentf0ecac2b70bf6b44b89dfa493abd2f544010b1eb (diff)
downloadgit-8642abc76454a6e09344e27a7797ff08264abe76.tar.gz
git-8642abc76454a6e09344e27a7797ff08264abe76.tar.xz
Merge branch 'tc/merge-m-log'
* tc/merge-m-log: merge: --log appends shortlog to message if specified fmt-merge-msg: add function to append shortlog only fmt-merge-msg: refactor merge title formatting fmt-merge-msg: minor refactor of fmt_merge_msg() merge: rename variable merge: update comment t7604-merge-custom-message: show that --log doesn't append to -m t7604-merge-custom-message: shift expected output creation Conflicts: builtin.h
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/builtin/merge.c b/builtin/merge.c
index 37d414b3b..37ce4f589 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -982,7 +982,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
reset_hard(remote_head->sha1, 0);
return 0;
} else {
- struct strbuf msg = STRBUF_INIT;
+ struct strbuf merge_names = STRBUF_INIT;
/* We are invoked directly as the first-class UI. */
head_arg = "HEAD";
@@ -995,13 +995,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
* codepath so we discard the error in this
* loop.
*/
- if (!have_message) {
- for (i = 0; i < argc; i++)
- merge_name(argv[i], &msg);
- fmt_merge_msg(option_log, &msg, &merge_msg);
- if (merge_msg.len)
- strbuf_setlen(&merge_msg, merge_msg.len-1);
- }
+ 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 (!(have_message && !option_log) && merge_msg.len)
+ strbuf_setlen(&merge_msg, merge_msg.len-1);
}
if (head_invalid || !argc)