enhance: the git dir of worktree's owner repository may not named .git

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-17 17:10:42 +08:00
parent 5845ef3eb6
commit 398b14695c
No known key found for this signature in database

View file

@ -459,7 +459,7 @@ namespace SourceGit.ViewModels
{
// For worktrees, we need to watch the $GIT_COMMON_DIR instead of the $GIT_DIR.
var gitDirForWatcher = _gitDir;
if (_gitDir.Replace("\\", "/").IndexOf(".git/worktrees/", StringComparison.Ordinal) > 0)
if (_gitDir.Replace("\\", "/").IndexOf("/worktrees/", StringComparison.Ordinal) > 0)
{
var commonDir = new Commands.QueryGitCommonDir(_fullpath).Result();
if (!string.IsNullOrEmpty(commonDir))