From a273cad23bb9f7a811fa26477e782a55dc36b0b7 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 26 Dec 2025 20:34:16 +0800 Subject: [PATCH] fix: worktree file status not updated (#2011) Signed-off-by: leo --- src/Models/Watcher.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Models/Watcher.cs b/src/Models/Watcher.cs index 03b4ca5f..cdeddd65 100644 --- a/src/Models/Watcher.cs +++ b/src/Models/Watcher.cs @@ -333,14 +333,13 @@ namespace SourceGit.Models private bool IsInSubmodule(string folder) { + if (string.IsNullOrEmpty(folder) || folder.Equals(_root, StringComparison.Ordinal)) + return false; + if (File.Exists($"{folder}/.git")) return true; - var parent = Path.GetDirectoryName(folder); - if (parent == null || parent.Equals(_root, StringComparison.Ordinal)) - return false; - - return IsInSubmodule(parent); + return IsInSubmodule(Path.GetDirectoryName(folder)); } private readonly IRepository _repo;