Skip to content

Commit f59af0a

Browse files
committed
enhance: only when the repository has submodules will the submodule information be updated at the same time after the branch information changes
1 parent e2da0d3 commit f59af0a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Models/Watcher.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,12 @@ private void OnRepositoryChanged(object o, FileSystemEventArgs e)
198198
(name.StartsWith("worktrees/", StringComparison.Ordinal) && name.EndsWith("/HEAD", StringComparison.Ordinal)))
199199
{
200200
_updateBranch = DateTime.Now.AddSeconds(.5).ToFileTime();
201-
_updateSubmodules = DateTime.Now.AddSeconds(1).ToFileTime();
201+
202+
lock (_submodules)
203+
{
204+
if (_submodules.Count > 0)
205+
_updateSubmodules = DateTime.Now.AddSeconds(1).ToFileTime();
206+
}
202207
}
203208
else if (name.StartsWith("objects/", StringComparison.Ordinal) || name.Equals("index", StringComparison.Ordinal))
204209
{

0 commit comments

Comments
 (0)