From: Junio C Hamano Date: Wed, 14 Oct 2009 18:51:03 +0000 (-0700) Subject: info/grafts: allow trailing whitespaces at the end of line X-Git-Tag: v1.6.5.3~12^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fe0a3cb23c7930be419937825591388465ceb47f;p=git.git info/grafts: allow trailing whitespaces at the end of line When creating an info/grafts under windows, one typically gets a CRLF file. There is no good reason to forbid trailing CR at the end of the line (for that matter, any trailing whitespaces); the code allowed only LF simply because that was good enough for the platforms with LF line endings. Signed-off-by: Junio C Hamano --- diff --git a/commit.c b/commit.c index aa3b35b6a..eee5ab803 100644 --- a/commit.c +++ b/commit.c @@ -136,8 +136,8 @@ struct commit_graft *read_graft_line(char *buf, int len) int i; struct commit_graft *graft = NULL; - if (buf[len-1] == '\n') - buf[--len] = 0; + while (len && isspace(buf[len-1])) + buf[--len] = '\0'; if (buf[0] == '#' || buf[0] == '\0') return NULL; if ((len + 1) % 41) {