2 * Copyright (C) the libgit2 contributors. All rights reserved.
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.
7 #ifndef INCLUDE_patch_h__
8 #define INCLUDE_patch_h__
10 #include "git2/patch.h"
13 /* cached information about a hunk in a patch */
14 typedef struct git_patch_hunk
{
23 git_repository
*repo
; /* may be null */
25 git_diff_options diff_opts
;
27 git_diff_delta
*delta
;
28 git_diff_binary binary
;
29 git_array_t(git_patch_hunk
) hunks
;
30 git_array_t(git_diff_line
) lines
;
36 void (*free_fn
)(git_patch
*patch
);
39 extern int git_patch__invoke_callbacks(
41 git_diff_file_cb file_cb
,
42 git_diff_binary_cb binary_cb
,
43 git_diff_hunk_cb hunk_cb
,
44 git_diff_line_cb line_cb
,
47 extern int git_patch_line_stats(
51 const git_patch
*patch
);
53 /** Options for parsing patch files. */
56 * The length of the prefix (in path segments) for the filenames.
57 * This prefix will be removed when looking for files. The default is 1.
62 #define GIT_PATCH_OPTIONS_INIT { 1 }
64 extern void git_patch_free(git_patch
*patch
);