summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-23 10:47:34 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:05 -0500
commitd536ceacf56e0ff1f02c8dc29d496bc1c357914f (patch)
tree7c5b9b42ec1ba694a4518c9d2cd0126a9ad7b4b9 /src/patch_parse.c
parent28f704433b949bfd7fe43a15aab0023b114fe706 (diff)
downloadlibgit2-d536ceacf56e0ff1f02c8dc29d496bc1c357914f.tar.gz
patch_parse: don't set new mode when deleted
Diffstat (limited to 'src/patch_parse.c')
-rw-r--r--src/patch_parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index f375688af..df2492ee5 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -881,10 +881,10 @@ static int check_patch(git_patch_parsed *patch)
patch->base.delta->status != GIT_DELTA_DELETED)
return parse_err("missing new file path");
- if (patch->base.delta->old_file.path && patch->base.delta->new_file.path) {
- if (!patch->base.delta->new_file.mode)
- patch->base.delta->new_file.mode = patch->base.delta->old_file.mode;
- }
+ if (patch->base.delta->old_file.path &&
+ patch->base.delta->status != GIT_DELTA_DELETED &&
+ !patch->base.delta->new_file.mode)
+ patch->base.delta->new_file.mode = patch->base.delta->old_file.mode;
if (patch->base.delta->status == GIT_DELTA_MODIFIED &&
!(patch->base.delta->flags & GIT_DIFF_FLAG_BINARY) &&