From: Junio C Hamano Date: Sat, 7 Nov 2009 07:17:47 +0000 (-0800) Subject: Merge branch 'jc/commit-s-subject-is-not-a-footer' X-Git-Tag: v1.6.6-rc0~70 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6e31f3dbb59c70cae04be3a1fc620e16d247e7d7?ds=sidebyside;hp=-c Merge branch 'jc/commit-s-subject-is-not-a-footer' * jc/commit-s-subject-is-not-a-footer: builtin-commit.c: fix logic to omit empty line before existing footers --- 6e31f3dbb59c70cae04be3a1fc620e16d247e7d7 diff --combined builtin-commit.c index beddf01dd3,cfa6b06e92..d525b894ec --- a/builtin-commit.c +++ b/builtin-commit.c @@@ -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); }