diff options
author | Vicent Martà <vicent@github.com> | 2013-06-12 14:52:47 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-06-12 14:52:47 -0700 |
commit | 93da7af707f7d6e9c466a319a7fa437883da7793 (patch) | |
tree | 48f6d384f1ec242581a60528790e969dbf94eb06 /src/diff_patch.h | |
parent | 5438e9c2b8eeb79c5580c576da6e110aa0cd2e59 (diff) | |
parent | 360f42f4b3f5de31270416220bd799b951202b2d (diff) | |
download | libgit2-93da7af707f7d6e9c466a319a7fa437883da7793.tar.gz |
Merge pull request #1642 from arrbee/diff-function-context
Diff code reorg plus function context in diff headers
Diffstat (limited to 'src/diff_patch.h')
-rw-r--r-- | src/diff_patch.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/diff_patch.h b/src/diff_patch.h new file mode 100644 index 000000000..56af14600 --- /dev/null +++ b/src/diff_patch.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_diff_patch_h__ +#define INCLUDE_diff_patch_h__ + +#include "common.h" +#include "diff.h" +#include "diff_file.h" +#include "array.h" + +extern git_diff_list *git_diff_patch__diff(git_diff_patch *); + +extern git_diff_driver *git_diff_patch__driver(git_diff_patch *); + +extern void git_diff_patch__old_data(char **, size_t *, git_diff_patch *); +extern void git_diff_patch__new_data(char **, size_t *, git_diff_patch *); + +extern int git_diff_patch__invoke_callbacks( + git_diff_patch *patch, + git_diff_file_cb file_cb, + git_diff_hunk_cb hunk_cb, + git_diff_data_cb line_cb, + void *payload); + +typedef struct git_diff_output git_diff_output; +struct git_diff_output { + /* these callbacks are issued with the diff data */ + git_diff_file_cb file_cb; + git_diff_hunk_cb hunk_cb; + git_diff_data_cb data_cb; + void *payload; + + /* this records the actual error in cases where it may be obscured */ + int error; + + /* this callback is used to do the diff and drive the other callbacks. + * see diff_xdiff.h for how to use this in practice for now. + */ + int (*diff_cb)(git_diff_output *output, git_diff_patch *patch); +}; + +#endif |