Code

git-commit: "read-tree -m HEAD" is not the right way to read-tree quickly
[git.git] / builtin-apply.c
index 3fefdacd94526b62ac72707d6d80b039f104c06d..bec95d6c8aa60ac40718f52da5a8f9603330dadb 100644 (file)
@@ -1539,7 +1539,8 @@ static int apply_line(char *output, const char *patch, int plen)
        int need_fix_leading_space = 0;
        char *buf;
 
-       if ((new_whitespace != strip_whitespace) || !whitespace_error) {
+       if ((new_whitespace != strip_whitespace) || !whitespace_error ||
+           *patch != '+') {
                memcpy(output, patch + 1, plen);
                return plen;
        }
@@ -1988,7 +1989,7 @@ static int check_patch(struct patch *patch, struct patch *prev_patch)
                        return error("%s: %s", old_name, strerror(errno));
 
                if (!cached)
-                       st_mode = ntohl(create_ce_mode(st.st_mode));
+                       st_mode = ntohl(ce_mode_from_stat(ce, st.st_mode));
 
                if (patch->is_new < 0)
                        patch->is_new = 0;