diff options
-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) && |