Make fetch/pull scripts terminate cleanly on errors
[gitweb.git] / apply.c
diff --git a/apply.c b/apply.c
index cf55fda71edba2ea4a78d52e714e37f46fda9691..1f48ef906fbf6c0f0a2efb6bf06599aa3081d30a 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -435,6 +435,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
                        { "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 },
@@ -569,7 +571,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
                        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;
                }
@@ -1186,6 +1188,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;