[PATCH] ssh-push: Don't add '/' to pathname
[git.git] / apply.c
diff --git a/apply.c b/apply.c
index 20c41c5..c0cd152 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -568,7 +568,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
                 */
                if (!memcmp("diff --git ", line, 11)) {
                        int git_hdr_len = parse_git_header(line, len, size, patch);
-                       if (git_hdr_len < 0)
+                       if (git_hdr_len <= len)
                                continue;
                        if (!patch->old_name && !patch->new_name)
                                die("git diff header lacks filename information (line %d)", linenr);
@@ -989,7 +989,7 @@ static int check_patch(struct patch *patch)
                int changed;
 
                if (lstat(old_name, &st) < 0)
-                       return error("%s: %s\n", strerror(errno));
+                       return error("%s: %s", old_name, strerror(errno));
                if (check_index) {
                        int pos = cache_name_pos(old_name, strlen(old_name));
                        if (pos < 0)
@@ -1000,6 +1000,7 @@ static int check_patch(struct patch *patch)
                }
                if (patch->is_new < 0)
                        patch->is_new = 0;
+               st.st_mode = ntohl(create_ce_mode(st.st_mode));
                if (!patch->old_mode)
                        patch->old_mode = st.st_mode;
                if ((st.st_mode ^ patch->old_mode) & S_IFMT)