From be3f418680aea6162e9c1ca6ef9919257dccb5cc Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 15 Apr 2025 11:03:34 +0800 Subject: [PATCH] fix: no diff content shows with new files (#1193) Signed-off-by: leo --- src/Commands/Diff.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index 1d112231..040fd5f8 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -36,12 +36,6 @@ namespace SourceGit.Commands public Models.DiffResult Result() { var rs = ReadToEnd(); - if (!rs.IsSuccess) - { - _result.TextDiff = null; - return _result; - } - var start = 0; var end = rs.StdOut.IndexOf('\n', start); while (end > 0) @@ -56,19 +50,15 @@ namespace SourceGit.Commands if (start < rs.StdOut.Length) ParseLine(rs.StdOut.Substring(start)); - if (_result.IsBinary || _result.IsLFS) + if (_result.IsBinary || _result.IsLFS || _result.TextDiff.Lines.Count == 0) { _result.TextDiff = null; } else { ProcessInlineHighlights(); - - if (_result.TextDiff.Lines.Count == 0) - _result.TextDiff = null; - else - _result.TextDiff.MaxLineNumber = Math.Max(_newLine, _oldLine); - } + _result.TextDiff.MaxLineNumber = Math.Max(_newLine, _oldLine); + } return _result; }