]> git.proxmox.com Git - libgit2.git/commitdiff
patch: when parsing, set nfiles correctly in delta
authorEdward Thomson <ethomson@microsoft.com>
Tue, 22 Sep 2015 22:29:14 +0000 (18:29 -0400)
committerEdward Thomson <ethomson@github.com>
Thu, 26 May 2016 18:01:05 +0000 (13:01 -0500)
src/patch_parse.c

index 323f8dc959fe0571341d6840ddf3655b11251a6d..d32d351e8ede11241963b12a4e570f11f0d6d557 100644 (file)
@@ -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;