{ "new file mode ", gitdiff_newfile },
{ "copy from ", gitdiff_copysrc },
{ "copy to ", gitdiff_copydst },
+ { "rename old ", gitdiff_renamesrc },
+ { "rename new ", gitdiff_renamedst },
{ "rename from ", gitdiff_renamesrc },
{ "rename to ", gitdiff_renamedst },
{ "similarity index ", gitdiff_similarity },
if (git_hdr_len < 0)
continue;
if (!patch->old_name && !patch->new_name)
- die("git diff header lacks filename information");
+ die("git diff header lacks filename information (line %d)", linenr);
*hdrsize = git_hdr_len;
return offset;
}
if (patch->is_new != !oldlines)
return error("new file depends on old contents");
- if (patch->is_delete != !newlines)
- return error("deleted file still has contents");
+ if (patch->is_delete != !newlines) {
+ if (newlines)
+ return error("deleted file still has contents");
+ fprintf(stderr, "** warning: file %s becomes empty but is not deleted\n", patch->new_name);
+ }
/* Parse the thing.. */
line += len;
static void write_out_results(struct patch *list)
{
+ if (!list)
+ die("No changes");
+
while (list) {
write_out_one_result(list);
list = list->next;