summaryrefslogtreecommitdiff
path: root/src/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-09-24 20:52:34 -0700
committerRussell Belfer <rb@github.com>2012-09-25 16:35:05 -0700
commit5f69a31f7d706aa5788ad9937391577a66e3c77d (patch)
tree8201821372d02499f092b774a8fd521478564a7e /src/diff.h
parent9a12a6256efa7da4b4245d0f2b7df6f3b84edabd (diff)
downloadlibgit2-5f69a31f7d706aa5788ad9937391577a66e3c77d.tar.gz
Initial implementation of new diff patch API
Replacing the `git_iterator` object, this creates a simple API for accessing the "patch" for any file pair in a diff list and then gives indexed access to the hunks in the patch and the lines in the hunk. This is the initial implementation of this revised API - it is still broken, but at least builds cleanly.
Diffstat (limited to 'src/diff.h')
-rw-r--r--src/diff.h32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/diff.h b/src/diff.h
index ea38a678f..862c33c1b 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -7,6 +7,9 @@
#ifndef INCLUDE_diff_h__
#define INCLUDE_diff_h__
+#include "git2/diff.h"
+#include "git2/oid.h"
+
#include <stdio.h>
#include "vector.h"
#include "buffer.h"
@@ -25,14 +28,17 @@ enum {
GIT_DIFFCAPS_USE_DEV = (1 << 4), /* use st_dev? */
};
-#define MAX_DIFF_FILESIZE 0x20000000
+typedef struct {
+ git_refcount rc;
+ git_diff_delta delta;
+} git_diff_delta_refcounted;
struct git_diff_list {
git_refcount rc;
git_repository *repo;
git_diff_options opts;
git_vector pathspec;
- git_vector deltas; /* vector of git_diff_file_delta */
+ git_vector deltas; /* vector of git_diff_delta_refcounted */
git_pool pool;
git_iterator_type_t old_src;
git_iterator_type_t new_src;
@@ -42,27 +48,7 @@ struct git_diff_list {
extern void git_diff__cleanup_modes(
uint32_t diffcaps, uint32_t *omode, uint32_t *nmode);
-/**
- * Return the maximum possible number of files in the diff.
- *
- * NOTE: This number has to be treated as an upper bound on the number of
- * files that have changed if the diff is with the working directory.
- *
- * Why?! For efficiency, we defer loading the file contents as long as
- * possible, so if a file has been "touched" in the working directory and
- * then reverted to the original content, it may get stored in the diff list
- * as MODIFIED along with a flag that the status should be reconfirmed when
- * it is actually loaded into memory. When that load happens, it could get
- * flipped to UNMODIFIED. If unmodified files are being skipped, then the
- * iterator will skip that file and this number may be too high.
- *
- * This behavior is true of `git_diff_foreach` as well, but the only
- * implication there is that the `progress` value would not advance evenly.
- *
- * @param iterator The iterator object
- * @return The maximum number of files to be iterated over
- */
-int git_diff_iterator__max_files(git_diff_iterator *iterator);
+extern void git_diff_list_addref(git_diff_list *diff);
#endif