diff_helpers.h 1.21 KB
Newer Older
1
#include "fileops.h"
2
#include "git2/diff.h"
3 4 5

extern git_tree *resolve_commit_oid_to_tree(
	git_repository *repo, const char *partial_oid);
6 7 8

typedef struct {
	int files;
9 10
	int files_binary;

11
	int file_status[10]; /* indexed by git_delta_t value */
12 13 14 15 16 17 18 19 20

	int hunks;
	int hunk_new_lines;
	int hunk_old_lines;

	int lines;
	int line_ctxt;
	int line_adds;
	int line_dels;
21 22 23 24 25 26 27

	/* optional arrays of expected specific values */
	const char **names;
	int *statuses;

	int debug;

28 29
} diff_expects;

30 31 32 33 34
typedef struct {
	const char *path;
	const char *matched_pathspec;
} notify_expected;

Vicent Marti committed
35
extern int diff_file_cb(
36
	const git_diff_delta *delta,
37 38
	float progress,
	void *cb_data);
39

40 41 42 43 44
extern int diff_print_file_cb(
	const git_diff_delta *delta,
	float progress,
	void *cb_data);

Vicent Marti committed
45
extern int diff_hunk_cb(
46
	const git_diff_delta *delta,
47
	const git_diff_hunk *hunk,
48
	void *cb_data);
49

Vicent Marti committed
50
extern int diff_line_cb(
51
	const git_diff_delta *delta,
52 53
	const git_diff_hunk *hunk,
	const git_diff_line *line,
54
	void *cb_data);
55

Russell Belfer committed
56
extern int diff_foreach_via_iterator(
57
	git_diff *diff,
Vicent Marti committed
58 59
	git_diff_file_cb file_cb,
	git_diff_hunk_cb hunk_cb,
60
	git_diff_line_cb line_cb,
61
	void *data);
62

63 64
extern void diff_print(FILE *fp, git_diff *diff);
extern void diff_print_raw(FILE *fp, git_diff *diff);