Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
diagnose: avoid poluting stderr stream in Git diagnostic
Avoid poluting the standard error stream with a 'fatal' Git error
message during the Git diagnostic run as part of the `diagnose` command.

When checking if we are inside of a Git repo we should be using an
explicit check for `IGit::IsInsideRepository` rather than trying to get
the current repo path and checking for null.
  • Loading branch information
mjcheetham committed Apr 17, 2024
commit eb6cd02503faf7a7f273603866170349a949ba8c
11 changes: 9 additions & 2 deletions src/shared/Core/Diagnostics/GitDiagnostic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ protected override Task<bool> RunInternalAsync(StringBuilder log, IList<string>
log.AppendLine($"Git version is '{gitVersion.OriginalString}'");

log.Append("Locating current repository...");
string thisRepo =CommandContext.Git.GetCurrentRepository();
if (!CommandContext.Git.IsInsideRepository())
{
log.AppendLine("Not inside a Git repository.");
}
else
{
string thisRepo = CommandContext.Git.GetCurrentRepository();
log.AppendLine($"Git repository at '{thisRepo}'");
}
log.AppendLine(" OK");
log.AppendLine(thisRepo is null ? "Not inside a Git repository." : $"Git repository at '{thisRepo}'");

log.Append("Listing all Git configuration...");
ChildProcess configProc = CommandContext.Git.CreateProcess("config --list --show-origin");
Expand Down