apply: check git diffs for missing old filenames
[gitweb.git] / apply.c
diff --git a/apply.c b/apply.c
index 705cf562f07098aafcd9f6e27105d2105714751f..1c0bcd737ee339832eaaaf38e26c21cd6036c5fe 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -1585,7 +1585,8 @@ static int find_header(struct apply_state *state,
                                patch->old_name = xstrdup(patch->def_name);
                                patch->new_name = xstrdup(patch->def_name);
                        }
-                       if (!patch->is_delete && !patch->new_name) {
+                       if ((!patch->new_name && !patch->is_delete) ||
+                           (!patch->old_name && !patch->is_new)) {
                                error(_("git diff header lacks filename information "
                                             "(line %d)"), state->linenr);
                                return -128;