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.).
This commit is contained in:
parent
1d89a5652d
commit
b06d4dbe2f
|
|
@ -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<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
|
|
|
|||
Loading…
Reference in New Issue