summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/commit.c b/commit.c
index fedbd5e526..6393e1b362 100644
--- a/commit.c
+++ b/commit.c
@@ -132,8 +132,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) {