diff:add option to ignore blank line changes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/.gitignore b/.gitignore
index 69d388f..1b482f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
/tags
CMakeSettings.json
.vs
+.idea
diff --git a/include/git2/diff.h b/include/git2/diff.h
index e105555..c63d93d 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -168,6 +168,10 @@ typedef enum {
* can apply given diff information to binary files.
*/
GIT_DIFF_SHOW_BINARY = (1u << 30),
+
+ /** Ignore blank lines */
+ GIT_DIFF_IGNORE_BLANK_LINES = (1u << 31),
+
} git_diff_option_t;
/**
diff --git a/src/diff_xdiff.c b/src/diff_xdiff.c
index c4668fa..7a32ea4 100644
--- a/src/diff_xdiff.c
+++ b/src/diff_xdiff.c
@@ -259,5 +259,8 @@ void git_xdiff_init(git_xdiff_output *xo, const git_diff_options *opts)
if (flags & GIT_DIFF_MINIMAL)
xo->params.flags |= XDF_NEED_MINIMAL;
+ if (flags & GIT_DIFF_IGNORE_BLANK_LINES)
+ xo->params.flags |= XDF_IGNORE_BLANK_LINES;
+
xo->callback.outf = git_xdiff_cb;
}