diff options
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r-- | include/git2/diff.h | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h index c0f48368e..7f165041a 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -88,10 +88,9 @@ typedef enum { GIT_DIFF_INCLUDE_UNTRACKED = (1 << 8), /** Include unmodified files in the diff list */ GIT_DIFF_INCLUDE_UNMODIFIED = (1 << 9), - /** Even with the GIT_DIFF_INCLUDE_UNTRACKED flag, when an untracked - * directory is found, only a single entry for the directory is added - * to the diff list; with this flag, all files under the directory will - * be included, too. + /** Even with GIT_DIFF_INCLUDE_UNTRACKED, an entire untracked directory + * will be marked with only a single entry in the diff list; this flag + * adds all files under the directory as UNTRACKED entries, too. */ GIT_DIFF_RECURSE_UNTRACKED_DIRS = (1 << 10), /** If the pathspec is set in the diff options, this flags means to @@ -120,6 +119,11 @@ typedef enum { GIT_DIFF_INCLUDE_TYPECHANGE_TREES = (1 << 16), /** Ignore file mode changes */ GIT_DIFF_IGNORE_FILEMODE = (1 << 17), + /** Even with GIT_DIFF_INCLUDE_IGNORED, an entire ignored directory + * will be marked with only a single entry in the diff list; this flag + * adds all files under the directory as IGNORED entries, too. + */ + GIT_DIFF_RECURSE_IGNORED_DIRS = (1 << 10), } git_diff_option_t; /** @@ -133,20 +137,18 @@ typedef enum { typedef struct git_diff_list git_diff_list; /** - * Flags for the file object on each side of a diff. + * Flags for the delta object and the file objects on each side. * - * Note: most of these flags are just for **internal** consumption by - * libgit2, but some of them may be interesting to external users. + * These flags are used for both the `flags` value of the `git_diff_delta` + * and the flags for the `git_diff_file` objects representing the old and + * new sides of the delta. Values outside of this public range should be + * considered reserved for internal or future use. */ typedef enum { - GIT_DIFF_FILE_VALID_OID = (1 << 0), /** `oid` value is known correct */ - GIT_DIFF_FILE_FREE_PATH = (1 << 1), /** `path` is allocated memory */ - GIT_DIFF_FILE_BINARY = (1 << 2), /** should be considered binary data */ - GIT_DIFF_FILE_NOT_BINARY = (1 << 3), /** should be considered text data */ - GIT_DIFF_FILE_FREE_DATA = (1 << 4), /** internal file data is allocated */ - GIT_DIFF_FILE_UNMAP_DATA = (1 << 5), /** internal file data is mmap'ed */ - GIT_DIFF_FILE_NO_DATA = (1 << 6), /** file data should not be loaded */ -} git_diff_file_flag_t; + GIT_DIFF_FLAG_BINARY = (1 << 0), /** file(s) treated as binary data */ + GIT_DIFF_FLAG_NOT_BINARY = (1 << 1), /** file(s) treated as text data */ + GIT_DIFF_FLAG_VALID_OID = (1 << 2), /** `oid` value is known correct */ +} git_diff_flag_t; /** * What type of change is described by a git_diff_delta? @@ -186,18 +188,17 @@ typedef enum { * * `size` is the size of the entry in bytes. * - * `flags` is a combination of the `git_diff_file_flag_t` types, but those - * are largely internal values. + * `flags` is a combination of the `git_diff_flag_t` types * * `mode` is, roughly, the stat() `st_mode` value for the item. This will * be restricted to one of the `git_filemode_t` values. */ typedef struct { - git_oid oid; + git_oid oid; const char *path; - git_off_t size; - unsigned int flags; - uint16_t mode; + git_off_t size; + uint32_t flags; + uint16_t mode; } git_diff_file; /** @@ -219,16 +220,17 @@ typedef struct { * * Under some circumstances, in the name of efficiency, not all fields will * be filled in, but we generally try to fill in as much as possible. One - * example is that the "binary" field will not examine file contents if you - * do not pass in hunk and/or line callbacks to the diff foreach iteration - * function. It will just use the git attributes for those files. + * example is that the "flags" field may not have either the `BINARY` or the + * `NOT_BINARY` flag set to avoid examining file contents if you do not pass + * in hunk and/or line callbacks to the diff foreach iteration function. It + * will just use the git attributes for those files. */ typedef struct { git_diff_file old_file; git_diff_file new_file; git_delta_t status; - unsigned int similarity; /**< for RENAMED and COPIED, value 0-100 */ - int binary; + uint32_t similarity; /**< for RENAMED and COPIED, value 0-100 */ + uint32_t flags; } git_diff_delta; /** |