]> git.proxmox.com Git - libgit2.git/blob - src/delta-apply.h
push: remove own copy of callbacks
[libgit2.git] / src / delta-apply.h
1 /*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_delta_apply_h__
8 #define INCLUDE_delta_apply_h__
9
10 #include "odb.h"
11
12 /**
13 * Apply a git binary delta to recover the original content.
14 *
15 * @param out the output buffer to receive the original data.
16 * Only out->data and out->len are populated, as this is
17 * the only information available in the delta.
18 * @param base the base to copy from during copy instructions.
19 * @param base_len number of bytes available at base.
20 * @param delta the delta to execute copy/insert instructions from.
21 * @param delta_len total number of bytes in the delta.
22 * @return
23 * - 0 on a successful delta unpack.
24 * - GIT_ERROR if the delta is corrupt or doesn't match the base.
25 */
26 extern int git__delta_apply(
27 git_rawobj *out,
28 const unsigned char *base,
29 size_t base_len,
30 const unsigned char *delta,
31 size_t delta_len);
32
33 /**
34 * Read the header of a git binary delta.
35 *
36 * @param delta the delta to execute copy/insert instructions from.
37 * @param delta_len total number of bytes in the delta.
38 * @param base_sz pointer to store the base size field.
39 * @param res_sz pointer to store the result size field.
40 * @return
41 * - 0 on a successful decoding the header.
42 * - GIT_ERROR if the delta is corrupt.
43 */
44 extern int git__delta_read_header(
45 const unsigned char *delta,
46 size_t delta_len,
47 size_t *base_sz,
48 size_t *res_sz);
49
50 #endif