summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-09-11 12:03:33 -0700
committerRussell Belfer <rb@github.com>2012-09-11 12:03:33 -0700
commit1f35e89dbf6e0be8952cc4324a45fd600be5ca05 (patch)
tree0489cf363f6bb7484c5de0f998b1acf3f831881b /include/git2/diff.h
parentc6ac28fdc57d04a9a5eba129cfd267c7adde43b3 (diff)
downloadlibgit2-1f35e89dbf6e0be8952cc4324a45fd600be5ca05.tar.gz
Fix diff binary file detection
In the process of adding tests for the max file size threshold (which treats files over a certain size as binary) there seem to be a number of problems in the new code with detecting binaries. This should fix those up, as well as add a test for the file size threshold stuff. Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I finally found a legitimate situation where it would be returned.
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r--include/git2/diff.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 4b4591a9e..05825c50d 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -79,13 +79,28 @@ typedef struct {
*/
typedef struct git_diff_list git_diff_list;
+/**
+ * Flags that can be set for the file on side of a diff.
+ *
+ * Most of the flags are just for internal consumption by libgit2,
+ * but some of them may be interesting to external users. They are:
+ *
+ * - VALID_OID - the `oid` value is computed and correct
+ * - FREE_PATH - the `path` string is separated allocated memory
+ * - BINARY - this file should be considered binary data
+ * - NOT_BINARY - this file should be considered text data
+ * - FREE_DATA - the internal file data is kept in allocated memory
+ * - UNMAP_DATA - the internal file data is kept in mmap'ed memory
+ * - NO_DATA - this side of the diff should not be loaded
+ */
enum {
GIT_DIFF_FILE_VALID_OID = (1 << 0),
GIT_DIFF_FILE_FREE_PATH = (1 << 1),
GIT_DIFF_FILE_BINARY = (1 << 2),
GIT_DIFF_FILE_NOT_BINARY = (1 << 3),
GIT_DIFF_FILE_FREE_DATA = (1 << 4),
- GIT_DIFF_FILE_UNMAP_DATA = (1 << 5)
+ GIT_DIFF_FILE_UNMAP_DATA = (1 << 5),
+ GIT_DIFF_FILE_NO_DATA = (1 << 6),
};
/**
@@ -176,7 +191,7 @@ enum {
GIT_DIFF_LINE_CONTEXT = ' ',
GIT_DIFF_LINE_ADDITION = '+',
GIT_DIFF_LINE_DELETION = '-',
- GIT_DIFF_LINE_ADD_EOFNL = '\n', /**< DEPRECATED - will not be returned */
+ GIT_DIFF_LINE_ADD_EOFNL = '\n', /**< Removed line w/o LF & added one with */
GIT_DIFF_LINE_DEL_EOFNL = '\0', /**< LF was removed at end of file */
/* The following values will only be sent to a `git_diff_data_fn` when