Flags for diff options. A combination of these flags can be passed
in via the flags
value in the git_diff_options
.
Normal diff, the default
Reverse the sides of the diff
Treat all files as text, disabling binary attributes & detection
Ignore all whitespace
Ignore changes in amount of whitespace
Ignore whitespace at end of line
Exclude submodules from the diff completely
Use the "patience diff" algorithm (currently unimplemented)
Include ignored files in the diff list
Include untracked files in the diff list
Include unmodified files in the diff list
Even with GIT_DIFF_INCLUDE_UNTRACKED, an entire untracked directory will be marked with only a single entry in the diff list (a la what core Git does in git status
); this flag adds all files under untracked directories as UNTRACKED entries, too.
If the pathspec is set in the diff options, this flags means to apply it as an exact match instead of as an fnmatch pattern.
Use case insensitive filename comparisons
When generating patch text, include the content of untracked files. This automatically turns on GIT_DIFF_INCLUDE_UNTRACKED but it does not turn on GIT_DIFF_RECURSE_UNTRACKED_DIRS. Add that flag if you want the content of every single UNTRACKED file.
Disable updating of the binary
flag in delta records. This is useful when iterating over a diff if you don't need hunk and data callbacks and want to avoid having to load file completely.
Normally, a type change between files will be converted into a DELETED record for the old and an ADDED record for the new; this options enabled the generation of TYPECHANGE delta records.
Even with GIT_DIFF_INCLUDE_TYPECHANGE, blob->tree changes still generally show as a DELETED blob. This flag tries to correctly label blob->tree transitions as TYPECHANGE records with new_file's mode set to tree. Note: the tree SHA will not be available.
Ignore file mode changes
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.
Core Git scans inside untracked directories, labeling them IGNORED if they are empty or only contain ignored files; a directory is consider UNTRACKED only if it has an actual untracked file in it. This scan is extra work for a case you often don't care about. This flag makes libgit2 immediately label an untracked directory as UNTRACKED without looking inside it (which differs from core Git). Of course, ignore rules are still checked for the directory itself.
Treat all files as binary, disabling text diffs