git_mkstemp(): be careful not to overflow the path buffer.
[gitweb.git] / builtin-apply.c
index c6f736c14e4840bde2efd204e7f88a3556e9eed9..0a0b4a9e3f6550b6a4729e94242811dcb6e8d09a 100644 (file)
@@ -1003,12 +1003,16 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
                        trailing++;
                        break;
                case '-':
+                       if (apply_in_reverse &&
+                                       new_whitespace != nowarn_whitespace)
+                               check_whitespace(line, len);
                        deleted++;
                        oldlines--;
                        trailing = 0;
                        break;
                case '+':
-                       if (new_whitespace != nowarn_whitespace)
+                       if (!apply_in_reverse &&
+                                       new_whitespace != nowarn_whitespace)
                                check_whitespace(line, len);
                        added++;
                        newlines--;