enhance: always turn off --color=<when> and --ext-diff when calling git diff in SourceGit (#1922)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2025-11-19 10:28:36 +08:00
parent 0670cf1c08
commit 4419b734a5
5 changed files with 7 additions and 7 deletions

View File

@@ -26,11 +26,11 @@ namespace SourceGit.Commands
Context = repo;
if (ignoreWhitespace)
Args = $"diff --no-ext-diff --patch --ignore-all-space --unified={unified} {opt}";
Args = $"diff --no-color --no-ext-diff --patch --ignore-all-space --unified={unified} {opt}";
else if (Models.DiffOption.IgnoreCRAtEOL)
Args = $"diff --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}";
Args = $"diff --no-color --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}";
else
Args = $"diff --no-ext-diff --patch --unified={unified} {opt}";
Args = $"diff --no-color --no-ext-diff --patch --unified={unified} {opt}";
}
public async Task<Models.DiffResult> ReadAsync()

View File

@@ -17,7 +17,7 @@ namespace SourceGit.Commands
{
WorkingDirectory = repo;
Context = repo;
Args = $"diff --diff-algorithm=minimal {opt}";
Args = $"diff --no-color --no-ext-diff --diff-algorithm=minimal {opt}";
}
public async Task<Result> ReadAsync()

View File

@@ -12,7 +12,7 @@ namespace SourceGit.Commands
{
WorkingDirectory = repo;
Context = repo;
Args = $"diff {Models.Commit.EmptyTreeSHA1} {commit} --numstat -- {path.Quoted()}";
Args = $"diff --no-color --no-ext-diff --numstat {Models.Commit.EmptyTreeSHA1} {commit} -- {path.Quoted()}";
RaiseError = false;
}

View File

@@ -10,7 +10,7 @@ namespace SourceGit.Commands
WorkingDirectory = repo;
Context = repo;
Args = $"diff -a --ignore-cr-at-eol --check {opt}";
Args = $"diff --no-color --no-ext-diff -a --ignore-cr-at-eol --check {opt}";
}
public bool GetResult()

View File

@@ -54,7 +54,7 @@ namespace SourceGit.Commands
var starter = new ProcessStartInfo();
starter.WorkingDirectory = repo;
starter.FileName = Native.OS.GitExecutable;
starter.Arguments = $"diff --ignore-cr-at-eol --unified=4 {opt}";
starter.Arguments = $"diff --no-color --no-ext-diff --ignore-cr-at-eol --unified=4 {opt}";
starter.UseShellExecute = false;
starter.CreateNoWindow = true;
starter.WindowStyle = ProcessWindowStyle.Hidden;