Merge branch 'jc/commit-s-subject-is-not-a-footer'
authorJunio C Hamano <gitster@pobox.com>
Sat, 7 Nov 2009 07:17:47 +0000 (23:17 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Nov 2009 07:17:47 +0000 (23:17 -0800)
* jc/commit-s-subject-is-not-a-footer:
builtin-commit.c: fix logic to omit empty line before existing footers

1  2 
builtin-commit.c
diff --combined builtin-commit.c
index beddf01dd37e6644db7eb33b1b3aea2a74272783,cfa6b06e92924484376d853eef7171d163fe7fe1..d525b894ec1211476707acb06bdebe25d5828dbb
@@@ -530,7 -530,7 +530,7 @@@ static int prepare_to_commit(const cha
                for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
                        ; /* do nothing */
                if (prefixcmp(sb.buf + i, sob.buf)) {
-                       if (!ends_rfc2822_footer(&sb))
+                       if (!i || !ends_rfc2822_footer(&sb))
                                strbuf_addch(&sb, '\n');
                        strbuf_addbuf(&sb, &sob);
                }
@@@ -725,10 -725,8 +725,10 @@@ static const char *find_author_by_nickn
        prepare_revision_walk(&revs);
        commit = get_revision(&revs);
        if (commit) {
 +              struct pretty_print_context ctx = {0};
 +              ctx.date_mode = DATE_NORMAL;
                strbuf_release(&buf);
 -              format_commit_message(commit, "%an <%ae>", &buf, DATE_NORMAL);
 +              format_commit_message(commit, "%an <%ae>", &buf, &ctx);
                return strbuf_detach(&buf, NULL);
        }
        die("No existing author found with '%s'", name);
@@@ -985,10 -983,8 +985,10 @@@ static void print_summary(const char *p
                initial_commit ? " (root-commit)" : "");
  
        if (!log_tree_commit(&rev, commit)) {
 +              struct pretty_print_context ctx = {0};
                struct strbuf buf = STRBUF_INIT;
 -              format_commit_message(commit, format + 7, &buf, DATE_NORMAL);
 +              ctx.date_mode = DATE_NORMAL;
 +              format_commit_message(commit, format + 7, &buf, &ctx);
                printf("%s\n", buf.buf);
                strbuf_release(&buf);
        }