Skip to content

Commit 4419b73

Browse files
committed
enhance: always turn off --color=<when> and --ext-diff when calling git diff in SourceGit (#1922)
Signed-off-by: leo <[email protected]>
1 parent 0670cf1 commit 4419b73

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/Commands/Diff.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public Diff(string repo, Models.DiffOption opt, int unified, bool ignoreWhitespa
2626
Context = repo;
2727

2828
if (ignoreWhitespace)
29-
Args = $"diff --no-ext-diff --patch --ignore-all-space --unified={unified} {opt}";
29+
Args = $"diff --no-color --no-ext-diff --patch --ignore-all-space --unified={unified} {opt}";
3030
else if (Models.DiffOption.IgnoreCRAtEOL)
31-
Args = $"diff --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}";
31+
Args = $"diff --no-color --no-ext-diff --patch --ignore-cr-at-eol --unified={unified} {opt}";
3232
else
33-
Args = $"diff --no-ext-diff --patch --unified={unified} {opt}";
33+
Args = $"diff --no-color --no-ext-diff --patch --unified={unified} {opt}";
3434
}
3535

3636
public async Task<Models.DiffResult> ReadAsync()

src/Commands/GenerateCommitMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public GetDiffContent(string repo, Models.DiffOption opt)
1717
{
1818
WorkingDirectory = repo;
1919
Context = repo;
20-
Args = $"diff --diff-algorithm=minimal {opt}";
20+
Args = $"diff --no-color --no-ext-diff --diff-algorithm=minimal {opt}";
2121
}
2222

2323
public async Task<Result> ReadAsync()

src/Commands/IsBinary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public IsBinary(string repo, string commit, string path)
1212
{
1313
WorkingDirectory = repo;
1414
Context = repo;
15-
Args = $"diff {Models.Commit.EmptyTreeSHA1} {commit} --numstat -- {path.Quoted()}";
15+
Args = $"diff --no-color --no-ext-diff --numstat {Models.Commit.EmptyTreeSHA1} {commit} -- {path.Quoted()}";
1616
RaiseError = false;
1717
}
1818

src/Commands/IsConflictResolved.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public IsConflictResolved(string repo, Models.Change change)
1010

1111
WorkingDirectory = repo;
1212
Context = repo;
13-
Args = $"diff -a --ignore-cr-at-eol --check {opt}";
13+
Args = $"diff --no-color --no-ext-diff -a --ignore-cr-at-eol --check {opt}";
1414
}
1515

1616
public bool GetResult()

src/Commands/SaveChangesAsPatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private static async Task<bool> ProcessSingleChangeAsync(string repo, Models.Dif
5454
var starter = new ProcessStartInfo();
5555
starter.WorkingDirectory = repo;
5656
starter.FileName = Native.OS.GitExecutable;
57-
starter.Arguments = $"diff --ignore-cr-at-eol --unified=4 {opt}";
57+
starter.Arguments = $"diff --no-color --no-ext-diff --ignore-cr-at-eol --unified=4 {opt}";
5858
starter.UseShellExecute = false;
5959
starter.CreateNoWindow = true;
6060
starter.WindowStyle = ProcessWindowStyle.Hidden;

0 commit comments

Comments
 (0)