summaryrefslogtreecommitdiff
path: root/src/diff.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2012-09-11 23:38:16 +0200
committerVicent Marti <tanoku@gmail.com>2012-09-11 23:38:16 +0200
commit412293dcc95369f0a42ae9a94f30fe7328a5491c (patch)
tree200d4bb5fa8cc3f8f037486e2128479048b8384e /src/diff.h
parent5a409c44baf2c7c2bd36fb8e8c2d5b2ce5b1908b (diff)
parentc859184bb459d9801a394dc44f5b0b0e55453263 (diff)
downloadlibgit2-412293dcc95369f0a42ae9a94f30fe7328a5491c.tar.gz
Merge branch 'diff-crlf-filters' into development
Diffstat (limited to 'src/diff.h')
-rw-r--r--src/diff.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/diff.h b/src/diff.h
index 2785fa425..ea38a678f 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -25,6 +25,8 @@ enum {
GIT_DIFFCAPS_USE_DEV = (1 << 4), /* use st_dev? */
};
+#define MAX_DIFF_FILESIZE 0x20000000
+
struct git_diff_list {
git_refcount rc;
git_repository *repo;
@@ -40,5 +42,27 @@ 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);
+
#endif