Skip to content

Commit

Permalink
info/grafts: allow trailing whitespaces at the end of line
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Oct 15, 2009
1 parent ba7e814 commit fe0a3cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fe0a3cb

Please sign in to comment.