info/grafts: allow trailing whitespaces at the end of line
[gitweb.git] / commit.c
index aa3b35b6a86891ac9d0628e20a6a46d506bf7700..eee5ab803b973f879cf59a93d820416efbf4e9ef 100644 (file)
--- 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) {