summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6bf1394)
raw | patch | inline | side by side (parent: 6bf1394)
author | Jeff King <peff@peff.net> | |
Thu, 26 May 2011 22:28:17 +0000 (18:28 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 26 May 2011 22:56:55 +0000 (15:56 -0700) |
In older versions of git, we used rfc822 header folding to
indicate that the original subject line had multiple lines
in it. But since a1f6baa (format-patch: wrap long header
lines, 2011-02-23), we now use header folding whenever there
is a long line.
This means that "git am" cannot trust header folding as a
sign from format-patch that newlines should be preserved.
Instead, format-patch needs to signal more explicitly that
the newlines are significant. This patch does so by
rfc2047-encoding the newlines in the subject line. No
changes are needed on the "git am" end; it already decodes
the newlines properly.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
indicate that the original subject line had multiple lines
in it. But since a1f6baa (format-patch: wrap long header
lines, 2011-02-23), we now use header folding whenever there
is a long line.
This means that "git am" cannot trust header folding as a
sign from format-patch that newlines should be preserved.
Instead, format-patch needs to signal more explicitly that
the newlines are significant. This patch does so by
rfc2047-encoding the newlines in the subject line. No
changes are needed on the "git am" end; it already decodes
the newlines properly.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/log.c | patch | blob | history | |
commit.h | patch | blob | history | |
log-tree.c | patch | blob | history | |
pretty.c | patch | blob | history | |
revision.h | patch | blob | history | |
t/t4152-am-subjects.sh | patch | blob | history |
diff --git a/builtin/log.c b/builtin/log.c
index 8d842cbcac8152798283a08d434506d6fcb69e76..0e46e5ae95a6ebb33d98cfde7505b50ed1a51c4d 100644 (file)
--- a/builtin/log.c
+++ b/builtin/log.c
die ("-n and -k are mutually exclusive.");
if (keep_subject && subject_prefix)
die ("--subject-prefix and -k are mutually exclusive.");
+ rev.preserve_subject = keep_subject;
argc = setup_revisions(argc, argv, &rev, &s_r_opt);
if (argc > 1)
diff --git a/commit.h b/commit.h
index 2935740a8da5607f23d6ef446e4ad9da9a92ad4d..e985dcc6e5d3d0f19db8bd691d226d00b234ae98 100644 (file)
--- a/commit.h
+++ b/commit.h
int abbrev;
const char *subject;
const char *after_subject;
+ int preserve_subject;
enum date_mode date_mode;
int need_8bit_cte;
int show_notes;
diff --git a/log-tree.c b/log-tree.c
index 0d8cc7af2ccbe4f8d0ca903072e5caa0b65542df..0c41789356f7fc54129a73cefcb815c5a9d8a7ba 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
ctx.date_mode = opt->date_mode;
ctx.abbrev = opt->diffopt.abbrev;
ctx.after_subject = extra_headers;
+ ctx.preserve_subject = opt->preserve_subject;
ctx.reflog_info = opt->reflog_info;
ctx.fmt = opt->commit_format;
pretty_print_commit(&ctx, commit, &msgbuf);
diff --git a/pretty.c b/pretty.c
index 1bb7e075eaf7e7a59502931fd4f57a9c391a7e4e..193bafd8352e72b0c3a7c65748500a558392e917 100644 (file)
--- a/pretty.c
+++ b/pretty.c
struct strbuf title;
strbuf_init(&title, 80);
- *msg_p = format_subject(&title, *msg_p, " ");
+ *msg_p = format_subject(&title, *msg_p,
+ pp->preserve_subject ? "\n" : " ");
strbuf_grow(sb, title.len + 1024);
if (pp->subject) {
diff --git a/revision.h b/revision.h
index 05659c64acd7fe8eb7be011cee6174e397e57baf..f8ddd83e79db99bfe93dee96696b6606916bd403 100644 (file)
--- a/revision.h
+++ b/revision.h
abbrev_commit:1,
use_terminator:1,
missing_newline:1,
- date_mode_explicit:1;
+ date_mode_explicit:1,
+ preserve_subject:1;
unsigned int disable_stdin:1;
enum date_mode date_mode;
diff --git a/t/t4152-am-subjects.sh b/t/t4152-am-subjects.sh
index 37e5c0361ca84b52d07893e8026410a18b50f356..4c68245acad30534d7e3e1f6e980e683d8b5aafd 100755 (executable)
--- a/t/t4152-am-subjects.sh
+++ b/t/t4152-am-subjects.sh
check_subject multiline-k
'
echo "$MULTILINE_SUBJECT" >expect
-test_expect_failure 'multiline subject preserved (format-patch -k | am -k)' '
+test_expect_success 'multiline subject preserved (format-patch -k | am -k)' '
check_subject multiline-k -k
'