Merge branch 'mg/status-b'
[gitweb.git] / builtin / fmt-merge-msg.c
index d0160cb8223051648900ed47fa84d218690ee6a8..44204257c72afd3a6a24966b9a11cf9f2374e9ce 100644 (file)
@@ -255,8 +255,8 @@ static void do_fmt_merge_msg_title(struct strbuf *out,
                strbuf_addf(out, " into %s\n", current_branch);
 }
 
-static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
-       struct strbuf *out) {
+static int do_fmt_merge_msg(int merge_title, int merge_summary,
+       struct strbuf *in, struct strbuf *out) {
        int limit = 20, i = 0, pos = 0;
        unsigned char head_sha1[20];
        const char *current_branch;
@@ -285,7 +285,8 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
        if (!srcs.nr)
                return 0;
 
-       do_fmt_merge_msg_title(out, current_branch);
+       if (merge_title)
+               do_fmt_merge_msg_title(out, current_branch);
 
        if (merge_summary) {
                struct commit *head;
@@ -297,6 +298,9 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
                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);
@@ -305,7 +309,11 @@ static int do_fmt_merge_msg(int merge_summary, struct strbuf *in,
 }
 
 int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
-       return do_fmt_merge_msg(merge_summary, in, out);
+       return do_fmt_merge_msg(1, merge_summary, in, out);
+}
+
+int fmt_merge_msg_shortlog(struct strbuf *in, struct strbuf *out) {
+       return do_fmt_merge_msg(0, 1, in, out);
 }
 
 int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)