summaryrefslogtreecommitdiff
path: root/src/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-02-08 10:06:47 -0800
committerRussell Belfer <rb@github.com>2013-02-20 15:10:21 -0800
commit71a3d27ea686845811f04314d02798b4f1745046 (patch)
tree5a37b36475fac0da6f8b04894c5dddf74b29e8fe /src/diff.h
parent9bc8be3d7e5134de1d912c7ef08d6207079bd8c1 (diff)
downloadlibgit2-71a3d27ea686845811f04314d02798b4f1745046.tar.gz
Replace diff delta binary with flags
Previously the git_diff_delta recorded if the delta was binary. This replaces that (with no net change in structure size) with a full set of flags. The flag values that were already in use for individual git_diff_file objects are reused for the delta flags, too (along with renaming those flags to make it clear that they are used more generally). This (a) makes things somewhat more consistent (because I was using a -1 value in the "boolean" binary field to indicate unset, whereas now I can just use the flags that are easier to understand), and (b) will make it easier for me to add some additional flags to the delta object in the future, such as marking the results of a copy/rename detection or other deltas that might want a special indicator. While making this change, I officially moved some of the flags that were internal only into the private diff header. This also allowed me to remove a gross hack in rename/copy detect code where I was overwriting the status field with an internal value.
Diffstat (limited to 'src/diff.h')
-rw-r--r--src/diff.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/diff.h b/src/diff.h
index 16fbf71e6..8e3cbcd46 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -28,8 +28,14 @@ enum {
GIT_DIFFCAPS_USE_DEV = (1 << 4), /* use st_dev? */
};
-#define GIT_DELTA__TO_DELETE 10
-#define GIT_DELTA__TO_SPLIT 11
+enum {
+ GIT_DIFF_FLAG__FREE_PATH = (1 << 7), /* `path` is allocated memory */
+ GIT_DIFF_FLAG__FREE_DATA = (1 << 8), /* internal file data is allocated */
+ GIT_DIFF_FLAG__UNMAP_DATA = (1 << 9), /* internal file data is mmap'ed */
+ GIT_DIFF_FLAG__NO_DATA = (1 << 10), /* file data should not be loaded */
+ GIT_DIFF_FLAG__TO_DELETE = (1 << 11), /* delete entry during rename det. */
+ GIT_DIFF_FLAG__TO_SPLIT = (1 << 12), /* split entry during rename det. */
+};
struct git_diff_list {
git_refcount rc;