enhance: show git errors when failed to get the repository root dir of given path (#397)

This commit is contained in:
leo 2024-08-27 15:35:10 +08:00
parent 963916219f
commit b16d267c9b
No known key found for this signature in database
14 changed files with 40 additions and 39 deletions

View file

@ -279,14 +279,14 @@ namespace SourceGit.Views
return;
}
var root = new Commands.QueryRepositoryRootPath(path).Result();
if (string.IsNullOrEmpty(root))
var test = new Commands.QueryRepositoryRootPath(path).ReadToEnd();
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
{
ViewModels.Welcome.Instance.InitRepository(path, parent);
ViewModels.Welcome.Instance.InitRepository(path, parent, test.StdErr);
return;
}
var normalizedPath = root.Replace("\\", "/");
var normalizedPath = test.StdOut.Trim().Replace("\\", "/");
var node = ViewModels.Preference.Instance.FindOrAddNodeByRepositoryPath(normalizedPath, parent, true);
ViewModels.Welcome.Instance.Refresh();