refactor: use $GIT_COMMON_DIR instead of cut $GIT_DIR/worktrees (#1103)

This commit is contained in:
Gadfly 2025-03-17 15:56:13 +08:00 committed by GitHub
parent 265aaa1d67
commit cea8a90680
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 51 additions and 16 deletions

View file

@ -282,6 +282,7 @@ namespace SourceGit.ViewModels
var isBare = new Commands.IsBareRepository(node.Id).Result();
var gitDir = node.Id;
var gitCommonDir = gitDir;
if (!isBare)
{
gitDir = new Commands.QueryGitDir(node.Id).Result();
@ -291,9 +292,12 @@ namespace SourceGit.ViewModels
App.RaiseException(ctx, "Given path is not a valid git repository!");
return;
}
gitCommonDir = new Commands.QueryGitCommonDir(node.Id).Result();
if (string.IsNullOrEmpty(gitCommonDir))
gitCommonDir = gitDir;
}
var repo = new Repository(isBare, node.Id, gitDir);
var repo = new Repository(isBare, node.Id, gitDir, gitCommonDir);
repo.Open();
if (page == null)