summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-06-25 16:27:06 +0900
committerEdward Thomson <ethomson@edwardthomson.com>2018-11-04 09:21:48 +0000
commit3b5378c58b00aaa2912a806e7baaea3e3c6d0dd3 (patch)
treeee41484a3bb4ec8c0f9bbb2d4425d8d49fc5cb44 /src
parentaf3287f828adb877501a130af255533f502eb88a (diff)
downloadlibgit2-3b5378c58b00aaa2912a806e7baaea3e3c6d0dd3.tar.gz
apply: handle file deletions
If the file was deleted in the postimage, do not attempt to update the target. Instead, ignore it and simply allow it to stay removed in our computed postimage. Also, test that we can handle file deletions.
Diffstat (limited to 'src')
-rw-r--r--src/apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/apply.c b/src/apply.c
index e761b270c..cc8e5f717 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -404,6 +404,9 @@ static int apply_one(
delta = git_patch_get_delta(patch);
+ if (delta->status == GIT_DELTA_DELETED)
+ goto done;
+
if ((error = git_reader_read(&pre_contents,
preimage_reader, delta->old_file.path)) < 0 ||
(error = git_apply__patch(&post_contents, &filename, &mode,