Re: [PATCH] commit: fix too generous RFC-2822 footer handling

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: SZEDER =?iso-8859-1?Q?G=E1bor?=
Date: Wednesday, November 4, 2009 - 8:11 am

Hi,


On Tue, Nov 03, 2009 at 10:11:21PM -0800, Junio C Hamano wrote:

I figured that the function ends_rfc2822_footer() should tell us
whether the message, well, ends with an rfc2822 _footer_.  But since
it may say so even if there is only a single line in the commit
message, I thought this function should be fixed in the first place.

But yeah, that solution was unnecessarily complicated, after a good
night's sleep I would do it this way:

diff --git a/builtin-commit.c b/builtin-commit.c
index beddf01..c7dcbd0 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -428,6 +428,8 @@ static int ends_rfc2822_footer(struct strbuf *sb)
                        break;
                hit = (buf[i] == '\n');
        }
+       if (i == 0)     /* one-line message */
+               return 0;
 
        while (i < len - 1 && buf[i] == '\n')
                i++;


You are right in that there is no need to look for an rfc-2822
formatted footer when the commit message has only a single line.  But
ends_rfc2822_footer() still not completely behaves as its name would
suggest (i.e. it might match even if there is no footer).  Perhaps it
could just be renamed to ends_rfc282().


Best,
Gábor
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] commit: More generous accepting of RFC-2822 fo ..., SZEDER =?iso-8859-1? ..., (Tue Nov 3, 9:59 am)
[PATCH] commit: fix too generous RFC-2822 footer handling, =?UTF-8?q?SZEDER=20G ..., (Tue Nov 3, 8:09 pm)
Re: [PATCH] commit: fix too generous RFC-2822 footer handling, SZEDER =?iso-8859-1? ..., (Wed Nov 4, 8:11 am)