X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=apply.c;h=20c41c51433d18b21b914f0e700501c5244de6e0;hb=e0f0e891c1742c6ae22dbc648a1000ad8655ff34;hp=e02e760be2c4e55659187b362406a129fd908f22;hpb=33f4d087a95a537095371a2fe02b96787518f389;p=git.git diff --git a/apply.c b/apply.c index e02e760b..20c41c51 100644 --- a/apply.c +++ b/apply.c @@ -437,6 +437,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch { "copy to ", gitdiff_copydst }, { "rename old ", gitdiff_renamesrc }, { "rename new ", gitdiff_renamedst }, + { "rename from ", gitdiff_renamesrc }, + { "rename to ", gitdiff_renamedst }, { "similarity index ", gitdiff_similarity }, { "dissimilarity index ", gitdiff_dissimilarity }, { "", gitdiff_unrecognized }, @@ -628,8 +630,11 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s 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; @@ -1186,6 +1191,9 @@ static void write_out_one_result(struct patch *patch) static void write_out_results(struct patch *list) { + if (!list) + die("No changes"); + while (list) { write_out_one_result(list); list = list->next;