]> git.ipfire.org Git - thirdparty/git.git/blobdiff - apply.c
Merge branch 'mt/add-chmod-fixes'
[thirdparty/git.git] / apply.c
diff --git a/apply.c b/apply.c
index 76dba93c974b3814117e3856d875e7e4381d2f62..668b16e9893d2f1e0501f2771716138db6e2efdd 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -3948,10 +3948,8 @@ static int check_patch(struct apply_state *state, struct patch *patch)
                        break; /* happy */
                case EXISTS_IN_INDEX:
                        return error(_("%s: already exists in index"), new_name);
-                       break;
                case EXISTS_IN_INDEX_AS_ITA:
                        return error(_("%s: does not match index"), new_name);
-                       break;
                case EXISTS_IN_WORKTREE:
                        return error(_("%s: already exists in working directory"),
                                     new_name);
@@ -4409,7 +4407,7 @@ static int create_one_file(struct apply_state *state,
                return 0;
 
        if (errno == ENOENT) {
-               if (safe_create_leading_directories(path))
+               if (safe_create_leading_directories_no_share(path))
                        return 0;
                res = try_create_file(state, path, mode, buf, size);
                if (res < 0)
@@ -4699,8 +4697,13 @@ static int apply_patch(struct apply_state *state,
                        reverse_patches(patch);
                if (use_patch(state, patch)) {
                        patch_stats(state, patch);
-                       *listp = patch;
-                       listp = &patch->next;
+                       if (!list || !state->apply_in_reverse) {
+                               *listp = patch;
+                               listp = &patch->next;
+                       } else {
+                               patch->next = list;
+                               list = patch;
+                       }
 
                        if ((patch->new_name &&
                             ends_with_path_components(patch->new_name,