Skip to content

Commit ed94f54

Browse files
committed
diff:add option to ignore blank line changes
1 parent cabfa3b commit ed94f54

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/tags
66
CMakeSettings.json
77
.vs
8+
.idea

include/git2/diff.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ typedef enum {
168168
* can apply given diff information to binary files.
169169
*/
170170
GIT_DIFF_SHOW_BINARY = (1u << 30),
171+
172+
/** Ignore blank lines */
173+
GIT_DIFF_IGNORE_BLANK_LINES = (1u << 31),
174+
171175
} git_diff_option_t;
172176

173177
/**

src/diff_xdiff.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,8 @@ void git_xdiff_init(git_xdiff_output *xo, const git_diff_options *opts)
259259
if (flags & GIT_DIFF_MINIMAL)
260260
xo->params.flags |= XDF_NEED_MINIMAL;
261261

262+
if (flags & GIT_DIFF_IGNORE_BLANK_LINES)
263+
xo->params.flags |= XDF_IGNORE_BLANK_LINES;
264+
262265
xo->callback.outf = git_xdiff_cb;
263266
}

0 commit comments

Comments
 (0)