Skip to content

Commit fe0a3cb

Browse files
committed
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 <[email protected]>
1 parent ba7e814 commit fe0a3cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ struct commit_graft *read_graft_line(char *buf, int len)
136136
int i;
137137
struct commit_graft *graft = NULL;
138138

139-
if (buf[len-1] == '\n')
140-
buf[--len] = 0;
139+
while (len && isspace(buf[len-1]))
140+
buf[--len] = '\0';
141141
if (buf[0] == '#' || buf[0] == '\0')
142142
return NULL;
143143
if ((len + 1) % 41) {

0 commit comments

Comments
 (0)