mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
refactor: use $GIT_COMMON_DIR instead of cut $GIT_DIR/worktrees (#1103)
This commit is contained in:
parent
265aaa1d67
commit
cea8a90680
14 changed files with 51 additions and 16 deletions
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
string FullPath { get; set; }
|
||||
string GitDir { get; set; }
|
||||
string GitCommonDir { get; set; }
|
||||
|
||||
void RefreshBranches();
|
||||
void RefreshWorktrees();
|
||||
|
|
|
@ -24,11 +24,7 @@ namespace SourceGit.Models
|
|||
_wcWatcher.EnableRaisingEvents = true;
|
||||
|
||||
// If this repository is a worktree repository, just watch the main repository's gitdir.
|
||||
var gitDirNormalized = _repo.GitDir.Replace("\\", "/");
|
||||
var worktreeIdx = gitDirNormalized.IndexOf(".git/worktrees/", StringComparison.Ordinal);
|
||||
var repoWatchDir = _repo.GitDir;
|
||||
if (worktreeIdx > 0)
|
||||
repoWatchDir = _repo.GitDir.Substring(0, worktreeIdx + 4);
|
||||
var repoWatchDir = _repo.GitCommonDir.Replace("\\", "/");
|
||||
|
||||
_repoWatcher = new FileSystemWatcher();
|
||||
_repoWatcher.Path = repoWatchDir;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue