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;