diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2009-01-03 04:21:30 -0800 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2009-01-03 04:21:30 -0800 |
commit | c23841c833ab35d82b32553d0659e815859e6c01 (patch) | |
tree | 6457fa0a84176ab4efb565b64170dff4175d68b9 /src/delta-apply.h | |
parent | bed3229b555ecd18bc7824c3ead7d2372b5f4f5a (diff) | |
download | libgit2-c23841c833ab35d82b32553d0659e815859e6c01.tar.gz |
Add the binary delta apply algorithm for pack style deltas
The git__delta_apply() function can be used to apply a Git style
delta, such as those used in pack files or in git patch files,
to recover the original object stream.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/delta-apply.h')
-rw-r--r-- | src/delta-apply.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/delta-apply.h b/src/delta-apply.h new file mode 100644 index 000000000..498bccdfe --- /dev/null +++ b/src/delta-apply.h @@ -0,0 +1,25 @@ +#ifndef INCLUDE_delta_apply_h__ +#define INCLUDE_delta_apply_h__ + +/** + * 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. + */ +extern int git__delta_apply( + git_obj *out, + const unsigned char *base, + size_t base_len, + const unsigned char *delta, + size_t delta_len); + +#endif |