Skip to content

Commit

Permalink
commit, cherry-pick -s: remove broken support for multiline rfc2822 f…
Browse files Browse the repository at this point in the history
…ields

Starting with c1e01b0 (commit: More generous accepting of RFC-2822 footer
lines, 2009-10-28), "git commit -s" carefully parses the last paragraph of
each commit message to check if it consists only of RFC2822-style headers,
in which case the signoff will be added as a new line in the same list:

   Reported-by: Reporter <reporter@example.com>
   Signed-off-by: Author <author@example.com>
   Acked-by: Lieutenant <lt@example.com>

It even included support for accepting indented continuation lines for
multiline fields.  Unfortunately the multiline field support is broken
because it checks whether buf[k] (the first character of the *next* line)
instead of buf[i] is a whitespace character.  The result is that any footer
with a continuation line is not accepted, since the last continuation line
neither starts with an RFC2822 field name nor is followed by a continuation
line.

That this has remained broken for so long is good evidence that nobody
actually needed multiline fields.  Rip out the broken continuation support.

There should be no functional change.

[Thanks to Jonathan Nieder for the excellent commit message]

Signed-off-by: Brandon Casey <bcasey@nvidia.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Feb 12, 2013
1 parent fa1727f commit 9b15152
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,6 @@ static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer)
char ch, prev;
int i, j, k;
int len = sb->len - ignore_footer;
int first = 1;
const char *buf = sb->buf;

prev = '\0';
Expand All @@ -1042,11 +1041,6 @@ static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer)
; /* do nothing */
k++;

if ((buf[k] == ' ' || buf[k] == '\t') && !first)
continue;

first = 0;

for (j = 0; i + j < len; j++) {
ch = buf[i + j];
if (ch == ':')
Expand Down

0 comments on commit 9b15152

Please sign in to comment.