diff --git a/LibGit2Sharp/CompareOptions.cs b/LibGit2Sharp/CompareOptions.cs
index fb4234439..abf67c32d 100644
--- a/LibGit2Sharp/CompareOptions.cs
+++ b/LibGit2Sharp/CompareOptions.cs
@@ -2,6 +2,25 @@
 
 namespace LibGit2Sharp
 {
+    /// <summary>
+    /// Represents a mode for handling whitespace while making diff.
+    /// </summary>
+    public enum DiffWhitespaceMode
+    {
+        /// <summary>
+        /// Ignore all whitespace
+        /// </summary>
+        IgnoreAllWhitespaces,
+        /// <summary>
+        /// Ignore changes in amount of whitespace
+        /// </summary>
+        IgnoreWhitespaceChange,
+        /// <summary>
+        /// Ignore whitespace at end of line
+        /// </summary>
+        IgnoreWhitespaceEol
+    }
+
     /// <summary>
     /// Options to define file comparison behavior.
     /// </summary>
@@ -34,6 +53,12 @@ public CompareOptions()
         /// </summary>
         public SimilarityOptions Similarity { get; set; }
 
+        /// <summary>
+        /// Represents a mode for handling whitespace while making diff.
+        /// By default is null - it means no extra flag is passed
+        /// </summary>
+        public DiffWhitespaceMode? WhitespaceMode { get; set; }
+
         /// <summary>
         /// Include "unmodified" entries in the results.
         /// </summary>
diff --git a/LibGit2Sharp/Diff.cs b/LibGit2Sharp/Diff.cs
index 087ee8d6d..5ac438561 100644
--- a/LibGit2Sharp/Diff.cs
+++ b/LibGit2Sharp/Diff.cs
@@ -58,6 +58,22 @@ private static GitDiffOptions BuildOptions(DiffModifiers diffOptions, FilePath[]
                 options.Flags |= GitDiffOptionFlags.GIT_DIFF_MINIMAL;
             }
 
+            if (compareOptions.WhitespaceMode != null)
+            {
+                if (compareOptions.WhitespaceMode == DiffWhitespaceMode.IgnoreAllWhitespaces)
+                {
+                    options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE;
+                }
+                else if (compareOptions.WhitespaceMode == DiffWhitespaceMode.IgnoreWhitespaceChange)
+                {
+                    options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_CHANGE;
+                }
+                else
+                {
+                    options.Flags |= GitDiffOptionFlags.GIT_DIFF_IGNORE_WHITESPACE_EOL;
+                }
+            }
+
             if (diffOptions.HasFlag(DiffModifiers.DisablePathspecMatch))
             {
                 options.Flags |= GitDiffOptionFlags.GIT_DIFF_DISABLE_PATHSPEC_MATCH;
@@ -546,7 +562,7 @@ private DiffHandle BuildDiffList(
 
             MatchedPathsAggregator matchedPaths = null;
 
-            // We can't match paths unless we've got something to match 
+            // We can't match paths unless we've got something to match
             // against and we're told to do so.
             if (filePaths != null && explicitPathsOptions != null)
             {