summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-22 18:29:14 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:05 -0500
commitbc6a31c9fbc3fc48d6a44bb752afd43fcb60ebef (patch)
tree3d25f58e1f3db371de7ac11fca6f26bd078434e5
parentd68cb736776e0f2f9494b49e2da30a9c4b9fc2c7 (diff)
downloadlibgit2-bc6a31c9fbc3fc48d6a44bb752afd43fcb60ebef.tar.gz
patch: when parsing, set nfiles correctly in delta
-rw-r--r--src/patch_parse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 323f8dc95..d32d351e8 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -242,6 +242,7 @@ static int parse_header_git_deletedfilemode(
patch->base.delta->old_file.path = NULL;
patch->base.delta->status = GIT_DELTA_DELETED;
+ patch->base.delta->nfiles = 1;
return parse_header_mode(&patch->base.delta->old_file.mode, ctx);
}
@@ -254,6 +255,7 @@ static int parse_header_git_newfilemode(
patch->base.delta->new_file.path = NULL;
patch->base.delta->status = GIT_DELTA_ADDED;
+ patch->base.delta->nfiles = 1;
return parse_header_mode(&patch->base.delta->new_file.mode, ctx);
}
@@ -886,6 +888,7 @@ int git_patch_from_patchfile(
patch->base.delta = git__calloc(1, sizeof(git_diff_delta));
patch->base.delta->status = GIT_DELTA_MODIFIED;
+ patch->base.delta->nfiles = 2;
ctx.content = content;
ctx.content_len = content_len;