diff --git a/builtin/apply.c b/builtin/apply.c
index 694f55dc5ac4c439eeaceadd3e1c70df5bb42aa1..84a8a0b52136c4d1e43ec10f9ef5ed76b7d3c12f 100644 (file)
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1407,6 +1407,9 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
"%d leading pathname components (line %d)" , p_value, linenr);
patch->old_name = patch->new_name = patch->def_name;
}
+ if (!patch->is_delete && !patch->new_name)
+ die("git diff header lacks filename information "
+ "(line %d)", linenr);
patch->is_toplevel_relative = 1;
*hdrsize = git_hdr_len;
return offset;