summaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apply.c b/apply.c
index 76dba93c97..668b16e989 100644
--- 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,