Skip to content

Commit

Permalink
Use PatchWhitespaceMode to build git diff options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Divad-H committed Apr 7, 2020
1 parent efe0ef0 commit 16f17b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions LibGit2Sharp/Diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ private static GitDiffOptions BuildOptions(DiffModifiers diffOptions, FilePath[]
options.Flags |= GitDiffOptionFlags.GIT_DIFF_INDENT_HEURISTIC;
}

switch (compareOptions.PatchWhitespaceMode)
{
case PatchWhitespaceMode.DontIgnoreWhitespace:
break;
case PatchWhitespaceMode.IgnoreAllWhitespace:
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE;
break;
case PatchWhitespaceMode.IgnoreWhitespaceChange:
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_CHANGE;
break;
case PatchWhitespaceMode.IgnoreWhitespaceEol:
options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_EOL;
break;
}

if (matchedPathsAggregator != null)
{
options.NotifyCallback = matchedPathsAggregator.OnGitDiffNotify;
Expand Down

0 comments on commit 16f17b0

Please sign in to comment.