Skip to content

Commit 0ae39fa

Browse files
committed
enhance: do not show hint: messages in error popup, but leave it in git command logs (#1348)
Signed-off-by: leo <[email protected]>
1 parent c112549 commit 0ae39fa

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

src/Commands/Command.cs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,30 @@ public bool Exec()
4444

4545
proc.OutputDataReceived += (_, e) =>
4646
{
47-
if (e.Data == null)
48-
return;
49-
50-
Log?.AppendLine(e.Data);
47+
if (e.Data is { } line)
48+
Log?.AppendLine(line);
5149
};
5250

5351
proc.ErrorDataReceived += (_, e) =>
5452
{
55-
if (string.IsNullOrEmpty(e.Data))
53+
var line = e.Data ?? string.Empty;
54+
Log?.AppendLine(line);
55+
56+
// Lines to hide in error message.
57+
if (line.Length > 0)
5658
{
57-
errs.Add(string.Empty);
58-
return;
59+
if (line.StartsWith("remote: Enumerating objects:", StringComparison.Ordinal) ||
60+
line.StartsWith("remote: Counting objects:", StringComparison.Ordinal) ||
61+
line.StartsWith("remote: Compressing objects:", StringComparison.Ordinal) ||
62+
line.StartsWith("Filtering content:", StringComparison.Ordinal) ||
63+
line.StartsWith("hint: ", StringComparison.Ordinal))
64+
return;
65+
66+
if (REG_PROGRESS().IsMatch(line))
67+
return;
5968
}
6069

61-
Log?.AppendLine(e.Data);
62-
63-
// Ignore progress messages
64-
if (e.Data.StartsWith("remote: Enumerating objects:", StringComparison.Ordinal))
65-
return;
66-
if (e.Data.StartsWith("remote: Counting objects:", StringComparison.Ordinal))
67-
return;
68-
if (e.Data.StartsWith("remote: Compressing objects:", StringComparison.Ordinal))
69-
return;
70-
if (e.Data.StartsWith("Filtering content:", StringComparison.Ordinal))
71-
return;
72-
if (REG_PROGRESS().IsMatch(e.Data))
73-
return;
74-
75-
errs.Add(e.Data);
70+
errs.Add(line);
7671
};
7772

7873
var dummy = null as Process;

0 commit comments

Comments
 (0)