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

@ -18,6 +18,11 @@ namespace SourceGit.ViewModels
{
public class Repository : ObservableObject, Models.IRepository
{
public bool IsBare
{
get;
}
public string FullPath
{
get => _fullpath;
@ -448,6 +453,13 @@ namespace SourceGit.ViewModels
private set => SetProperty(ref _isAutoFetching, value);
}
public Repository(bool isBare, string path, string gitDir)
{
IsBare = isBare;
FullPath = path;
GitDir = gitDir;
}
public void Open()
{
var settingsFile = Path.Combine(_gitDir, "sourcegit.settings");
@ -995,6 +1007,9 @@ namespace SourceGit.ViewModels
public void RefreshWorkingCopyChanges()
{
if (IsBare)
return;
var changes = new Commands.QueryLocalChanges(_fullpath, _settings.IncludeUntrackedInLocalChanges).Result();
if (_workingCopy == null)
return;
@ -1010,6 +1025,9 @@ namespace SourceGit.ViewModels
public void RefreshStashes()
{
if (IsBare)
return;
var stashes = new Commands.QueryStashes(_fullpath).Result();
Dispatcher.UIThread.Invoke(() =>
{