feature: bare repository support

This commit is contained in:
leo 2025-01-13 19:49:50 +08:00
parent cc5f3ebfa5
commit b9b5220590
No known key found for this signature in database
6 changed files with 89 additions and 48 deletions

View file

@ -94,20 +94,20 @@ namespace SourceGit.ViewModels
}
var isBare = new Commands.IsBareRepository(path).Result();
if (isBare)
var repoRoot = path;
if (!isBare)
{
App.RaiseException(string.Empty, $"'{path}' is a bare repository, which is not supported by SourceGit!");
return;
var test = new Commands.QueryRepositoryRootPath(path).ReadToEnd();
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
{
InitRepository(path, parent, test.StdErr);
return;
}
repoRoot = test.StdOut.Trim();
}
var test = new Commands.QueryRepositoryRootPath(path).ReadToEnd();
if (!test.IsSuccess || string.IsNullOrEmpty(test.StdOut))
{
InitRepository(path, parent, test.StdErr);
return;
}
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(test.StdOut.Trim(), parent, bMoveExistedNode);
var node = Preferences.Instance.FindOrAddNodeByRepositoryPath(repoRoot, parent, bMoveExistedNode);
Refresh();
var launcher = App.GetLauncer();