Skip to content

Commit 16f17b0

Browse files
committed
Use PatchWhitespaceMode to build git diff options.
1 parent efe0ef0 commit 16f17b0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

LibGit2Sharp/Diff.cs

+15
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ private static GitDiffOptions BuildOptions(DiffModifiers diffOptions, FilePath[]
6868
options.Flags |= GitDiffOptionFlags.GIT_DIFF_INDENT_HEURISTIC;
6969
}
7070

71+
switch (compareOptions.PatchWhitespaceMode)
72+
{
73+
case PatchWhitespaceMode.DontIgnoreWhitespace:
74+
break;
75+
case PatchWhitespaceMode.IgnoreAllWhitespace:
76+
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE;
77+
break;
78+
case PatchWhitespaceMode.IgnoreWhitespaceChange:
79+
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_CHANGE;
80+
break;
81+
case PatchWhitespaceMode.IgnoreWhitespaceEol:
82+
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_EOL;
83+
break;
84+
}
85+
7186
if (matchedPathsAggregator != null)
7287
{
7388
options.NotifyCallback = matchedPathsAggregator.OnGitDiffNotify;

0 commit comments

Comments
 (0)