Merge branch 'ls/p4-lfs'
[gitweb.git] / builtin / apply.c
index 146be97a1a879242aa12eb066c5c69cd6af92409..4aa53f7fd87d5fd23c0929360b6746f48e8e3e73 100644 (file)
@@ -785,7 +785,7 @@ static int guess_p_value(const char *nameline)
 }
 
 /*
- * Does the ---/+++ line has the POSIX timestamp after the last HT?
+ * Does the ---/+++ line have the POSIX timestamp after the last HT?
  * GNU diff puts epoch there to signal a creation/deletion event.  Is
  * this such a timestamp?
  */
@@ -1638,6 +1638,9 @@ static int parse_fragment(const char *line, unsigned long size,
        }
        if (oldlines || newlines)
                return -1;
+       if (!deleted && !added)
+               return -1;
+
        fragment->leading = leading;
        fragment->trailing = trailing;