libgit2/tests-clar/diff/diff_helpers.h
Russell Belfer f335ecd6e1 Diff iterators
This refactors the diff output code so that an iterator object
can be used to traverse and generate the diffs, instead of just
the `foreach()` style with callbacks.  The code has been rearranged
so that the two styles can still share most functions.

This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
that as a common error code for marking the end of iteration when
using a iterator style of object.
2012-09-05 15:17:24 -07:00

54 lines
975 B
C

#include "fileops.h"
#include "git2/diff.h"
extern git_tree *resolve_commit_oid_to_tree(
git_repository *repo, const char *partial_oid);
typedef struct {
int files;
int file_adds;
int file_dels;
int file_mods;
int file_ignored;
int file_untracked;
int file_unmodified;
int hunks;
int hunk_new_lines;
int hunk_old_lines;
int lines;
int line_ctxt;
int line_adds;
int line_dels;
bool at_least_one_of_them_is_binary;
} diff_expects;
extern int diff_file_fn(
void *cb_data,
git_diff_delta *delta,
float progress);
extern int diff_hunk_fn(
void *cb_data,
git_diff_delta *delta,
git_diff_range *range,
const char *header,
size_t header_len);
extern int diff_line_fn(
void *cb_data,
git_diff_delta *delta,
git_diff_range *range,
char line_origin,
const char *content,
size_t content_len);
extern int diff_foreach_via_iterator(
git_diff_list *diff,
void *data,
git_diff_file_fn file_cb,
git_diff_hunk_fn hunk_cb,
git_diff_data_fn line_cb);