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

@ -280,19 +280,20 @@ namespace SourceGit.ViewModels
return;
}
var gitDir = new Commands.QueryGitDir(node.Id).Result();
if (string.IsNullOrEmpty(gitDir))
var isBare = new Commands.IsBareRepository(node.Id).Result();
var gitDir = node.Id;
if (!isBare)
{
var ctx = page == null ? ActivePage.Node.Id : page.Node.Id;
App.RaiseException(ctx, "Given path is not a valid git repository!");
return;
gitDir = new Commands.QueryGitDir(node.Id).Result();
if (string.IsNullOrEmpty(gitDir))
{
var ctx = page == null ? ActivePage.Node.Id : page.Node.Id;
App.RaiseException(ctx, "Given path is not a valid git repository!");
return;
}
}
var repo = new Repository()
{
FullPath = node.Id,
GitDir = gitDir,
};
var repo = new Repository(isBare, node.Id, gitDir);
repo.Open();
if (page == null)