X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-apply.c;h=f312798af38553e0badeda9732736a62460eae05;hb=81d3fe9f4871e42ebd1af0221fa091fe5476e2f7;hp=6d5a60214ca5de6cb4376a66503cb8149b7ef997;hpb=d9fde065bd808fbbad3b53e10e160c8f8193b577;p=git.git diff --git a/builtin-apply.c b/builtin-apply.c index 6d5a60214..f312798af 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -1258,8 +1258,9 @@ static char *inflate_it(const void *data, unsigned long size, stream.avail_in = size; stream.next_out = out = xmalloc(inflated_size); stream.avail_out = inflated_size; - inflateInit(&stream); - st = inflate(&stream, Z_FINISH); + git_inflate_init(&stream); + st = git_inflate(&stream, Z_FINISH); + git_inflate_end(&stream); if ((st != Z_STREAM_END) || stream.total_out != inflated_size) { free(out); return NULL; @@ -2440,7 +2441,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s return error("%s: %s", old_name, strerror(errno)); } - if (!cached) + if (!cached && !tpatch) st_mode = ce_mode_from_stat(*ce, st->st_mode); if (patch->is_new < 0) @@ -2452,7 +2453,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s if (st_mode != patch->old_mode) fprintf(stderr, "warning: %s has type %o, expected %o\n", old_name, st_mode, patch->old_mode); - if (!patch->new_mode) + if (!patch->new_mode && !patch->is_delete) patch->new_mode = st_mode; return 0;