From b06d4dbe2ff3feee3e44b96272eedea787e62fe2 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Thu, 23 Jul 2026 08:58:22 +0200 Subject: [PATCH] Detect workspace changes in updateStatus When projectBaseDir() returns a different path, re-run detectWorkspace() and setupFileWatcher(). This catches project switches regardless of which signal triggers the refresh (viewChanged, doc save, timer, etc.). --- gitplusplus.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gitplusplus.cpp b/gitplusplus.cpp index dbe3641..26a4d94 100644 --- a/gitplusplus.cpp +++ b/gitplusplus.cpp @@ -1064,10 +1064,21 @@ void GitPlusPlusView::onProjectChanged() void GitPlusPlusView::updateStatus() { - m_gitDir = projectBaseDir(); - if (m_gitDir.isEmpty()) { - setMessage(QStringLiteral("No project directory found"), true); - return; + QString newDir = projectBaseDir(); + if (newDir != m_gitDir) { + m_gitDir = newDir; + detectWorkspace(); + if (m_gitDir.isEmpty()) { + setMessage(QStringLiteral("No project directory found"), true); + return; + } + setupFileWatcher(); + } else { + m_gitDir = newDir; + if (m_gitDir.isEmpty()) { + setMessage(QStringLiteral("No project directory found"), true); + return; + } } auto *proc = GitProcess::create(m_gitDir, {QStringLiteral("status"), QStringLiteral("--porcelain=v1")}, this); connect(proc, QOverload::of(&QProcess::finished),