diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2017-08-18 15:20:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-23 15:12:07 -0700 |
commit | 7b3aa75df7db72a283a11b9ce41658b89576db2b (patch) | |
tree | 21f4a19de17bc52fbf779ca4227a2462af3fd4ea /sha1_file.c | |
parent | 32b42e152fcc453273fadb5a7d639e4e9b506783 (diff) | |
download | git-7b3aa75df7db72a283a11b9ce41658b89576db2b.tar.gz |
pack: move get_size_from_delta()
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/sha1_file.c b/sha1_file.c index 24f4249564..38c1084560 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1101,45 +1101,6 @@ int parse_sha1_header(const char *hdr, unsigned long *sizep) return parse_sha1_header_extended(hdr, &oi, 0); } -unsigned long get_size_from_delta(struct packed_git *p, - struct pack_window **w_curs, - off_t curpos) -{ - const unsigned char *data; - unsigned char delta_head[20], *in; - git_zstream stream; - int st; - - memset(&stream, 0, sizeof(stream)); - stream.next_out = delta_head; - stream.avail_out = sizeof(delta_head); - - git_inflate_init(&stream); - do { - in = use_pack(p, w_curs, curpos, &stream.avail_in); - stream.next_in = in; - st = git_inflate(&stream, Z_FINISH); - curpos += stream.next_in - in; - } while ((st == Z_OK || st == Z_BUF_ERROR) && - stream.total_out < sizeof(delta_head)); - git_inflate_end(&stream); - if ((st != Z_STREAM_END) && stream.total_out != sizeof(delta_head)) { - error("delta data unpack-initial failed"); - return 0; - } - - /* Examine the initial part of the delta to figure out - * the result size. - */ - data = delta_head; - - /* ignore base size */ - get_delta_hdr_size(&data, delta_head+sizeof(delta_head)); - - /* Read the result size */ - return get_delta_hdr_size(&data, delta_head+sizeof(delta_head)); -} - static off_t get_delta_base(struct packed_git *p, struct pack_window **w_curs, off_t *curpos, |