Re: Some Commit Messages Scare git-rev-list
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Apr 12, 2006, 17:23 UTC
- Message-ID
- <Pine.LNX.4.64.0604121002220.14565@g5.osdl.org>
- In-Reply-To
- <1144847462.5213.6.camel@localhost.localdomain>
On Wed, 12 Apr 2006, Darrin Thompson wrote:
> > This scripts exhibits some odd behavior. Apparently git-rev-list > mishandles commit messages which do not end in a newline. This as best I > can tell this is a problem introduced since 1.1.5.
Fixed like so..
However, your script shows another problem: the "#" added at the end of the line for a
echo -n "duh" | git-commit -F - -a
seems to be because we append the "git status" output to it, and then we drop the lines that start with a '#', but due to the "-n", the first # ends up being at the end of the line.
I suspect that when we get the commit message like that, we should _not_ do any of the commit message editing at all.
That's a separate issue, though, and not fixed by this patch.
Linus
---
diff --git a/commit.c b/commit.c index d534c9b..c7bb8db 100644 --- a/commit.c +++ b/commit.c @@ -400,11 +400,11 @@ static int get_one_line(const char *msg, while (len--) { char c = *msg++; + if (!c) + break; ret++; if (c == '\n') break; - if (!c) - return 0; } return ret; }