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),