From 166f335e83842acd1cbeb099f94563ceff9bd726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6ran=20W?= Date: Wed, 17 Jun 2026 21:40:14 +0200 Subject: [PATCH] [enhancement] Add option '--ignore-blank-lines' when ignoring whitespace changes * This causes some more cases of changes in (added/removed) empty lines to be ignored (but apparently not when there also other unignored changes in the same file). * Still, it's a useful addition wherever it applies, since it helps in quickly skipping over files that have only empty-line changes. * Related to discussion in PR #2411. * Also renamed argument 'unified' to 'numContextLines', for clarity. --- src/Commands/Diff.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index a7b80c14d..d8bf4b8af 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -20,7 +20,7 @@ public partial class Diff : Command private const string PREFIX_LFS_DEL = "-version https://git-lfs.github.com/spec/"; private const string PREFIX_LFS_MODIFY = " version https://git-lfs.github.com/spec/"; - public Diff(string repo, Models.DiffOption opt, int unified, bool ignoreWhitespace, bool ignoreCRAtEOL) + public Diff(string repo, Models.DiffOption opt, int numContextLines, bool ignoreWhitespace, bool ignoreCRAtEOL) { _result.TextDiff = new Models.TextDiff(); @@ -30,10 +30,10 @@ public Diff(string repo, Models.DiffOption opt, int unified, bool ignoreWhitespa var builder = new StringBuilder(256); builder.Append("diff --no-color --no-ext-diff --full-index --patch "); if (ignoreWhitespace) - builder.Append("--ignore-space-change "); + builder.Append("--ignore-space-change --ignore-blank-lines "); if (ignoreCRAtEOL) builder.Append("--ignore-cr-at-eol "); - builder.Append("--unified=").Append(unified).Append(' '); + builder.Append("--unified=").Append(numContextLines).Append(' '); builder.Append(opt.ToString()); Args = builder.ToString();