From f59af0afcfc1d6993f023b00cc8beef354f3b711 Mon Sep 17 00:00:00 2001 From: leo Date: Sun, 11 Aug 2024 10:13:01 +0800 Subject: [PATCH] enhance: only when the repository has submodules will the submodule information be updated at the same time after the branch information changes --- src/Models/Watcher.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Models/Watcher.cs b/src/Models/Watcher.cs index 06288630..d10d8670 100644 --- a/src/Models/Watcher.cs +++ b/src/Models/Watcher.cs @@ -198,7 +198,12 @@ namespace SourceGit.Models (name.StartsWith("worktrees/", StringComparison.Ordinal) && name.EndsWith("/HEAD", StringComparison.Ordinal))) { _updateBranch = DateTime.Now.AddSeconds(.5).ToFileTime(); - _updateSubmodules = DateTime.Now.AddSeconds(1).ToFileTime(); + + lock (_submodules) + { + if (_submodules.Count > 0) + _updateSubmodules = DateTime.Now.AddSeconds(1).ToFileTime(); + } } else if (name.StartsWith("objects/", StringComparison.Ordinal) || name.Equals("index", StringComparison.Ordinal)) {