delta-apply.h 1.02 KB
Newer Older
Vicent Marti committed
1
/*
schu committed
2
 * Copyright (C) 2009-2012 the libgit2 contributors
Vicent Marti committed
3 4 5 6
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
7 8 9
#ifndef INCLUDE_delta_apply_h__
#define INCLUDE_delta_apply_h__

Vicent Marti committed
10 11
#include "odb.h"

12 13 14 15 16 17 18 19 20 21 22 23 24 25
/**
 * Apply a git binary delta to recover the original content.
 *
 * @param out the output buffer to receive the original data.
 *		Only out->data and out->len are populated, as this is
 *		the only information available in the delta.
 * @param base the base to copy from during copy instructions.
 * @param base_len number of bytes available at base.
 * @param delta the delta to execute copy/insert instructions from.
 * @param delta_len total number of bytes in the delta.
 * @return
 * - GIT_SUCCESS on a successful delta unpack.
 * - GIT_ERROR if the delta is corrupt or doesn't match the base.
 */
26
extern int git__delta_apply(
27
	git_rawobj *out,
28 29 30 31 32 33
	const unsigned char *base,
	size_t base_len,
	const unsigned char *delta,
	size_t delta_len);

#endif