@matheusbsbs / matheus-bagliano / commits / fe0a3cb23c
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Oct 14, 2009 at 11:51 UTC fe0a3cb23c7930be419937825591388465ceb47f
1 file changed +2 -2
commit.c
+2 -2
@@ -136,8 +136,8 @@ struct commit_graft *read_graft_line(char *buf, int len)
136 int i;
137 struct commit_graft *graft = NULL;
138
139 - if (buf[len-1] == '\n')
140 - buf[--len] = 0;
139 + while (len && isspace(buf[len-1]))
140 + buf[--len] = '\0';
141 if (buf[0] == '#' || buf[0] == '\0')
142 return NULL;
143 if ((len + 1) % 41) {