summaryrefslogtreecommitdiff
path: root/tests-clar/diff/diff_helpers.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-02-03 16:53:01 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-03-02 15:49:28 -0800
commit3a4375901a92efdc641c714ec9fd07b53f2f781e (patch)
treea0aed2d5e7ee9a6c2af317ae44e1f8bdce0a1446 /tests-clar/diff/diff_helpers.h
parent65b09b1deddec64fa5639e9fea10c048d31901fa (diff)
downloadlibgit2-3a4375901a92efdc641c714ec9fd07b53f2f781e.tar.gz
Clean up diff implementation for review
This fixes several bugs, updates tests and docs, eliminates the FILE* assumption in favor of printing callbacks for the diff patch formatter helpers, and adds a "diff" example function that can perform a diff from the command line.
Diffstat (limited to 'tests-clar/diff/diff_helpers.h')
-rw-r--r--tests-clar/diff/diff_helpers.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests-clar/diff/diff_helpers.h b/tests-clar/diff/diff_helpers.h
index a75dd912c..4c3e7580e 100644
--- a/tests-clar/diff/diff_helpers.h
+++ b/tests-clar/diff/diff_helpers.h
@@ -1,4 +1,40 @@
#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 hunks;
+ int hunk_new_lines;
+ int hunk_old_lines;
+
+ int lines;
+ int line_ctxt;
+ int line_adds;
+ int line_dels;
+} 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,
+ char line_origin,
+ const char *content,
+ size_t content_len);