diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-23 10:47:34 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-05-26 13:01:05 -0500 |
commit | d536ceacf56e0ff1f02c8dc29d496bc1c357914f (patch) | |
tree | 7c5b9b42ec1ba694a4518c9d2cd0126a9ad7b4b9 /src/patch_parse.c | |
parent | 28f704433b949bfd7fe43a15aab0023b114fe706 (diff) | |
download | libgit2-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.c | 8 |
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) && |