diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 1520e34ce26f9764ba03df881feb551c205a1d2c..38a88b1bc3e3894c52e73a7d6f369d838bb85ec1 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -788,17 +788,19 @@ void GitPlugin::resetRepository() void GitPlugin::startRebase() { - QString workingDirectory = currentState().currentDirectoryOrTopLevel(); - if (workingDirectory.isEmpty() || !m_gitClient->canRebase(workingDirectory)) + const VcsBase::VcsBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return); + const QString topLevel = state.topLevel(); + if (topLevel.isEmpty() || !m_gitClient->canRebase(topLevel)) return; - if (!m_gitClient->beginStashScope(workingDirectory, QLatin1String("Rebase-i"))) + if (!m_gitClient->beginStashScope(topLevel, QLatin1String("Rebase-i"))) return; LogChangeDialog dialog(false); dialog.setWindowTitle(tr("Interactive Rebase")); - if (dialog.runDialog(workingDirectory, QString(), false)) - m_gitClient->interactiveRebase(workingDirectory, dialog.commit(), false); + if (dialog.runDialog(topLevel, QString(), false)) + m_gitClient->interactiveRebase(topLevel, dialog.commit(), false); else - m_gitClient->endStashScope(workingDirectory); + m_gitClient->endStashScope(topLevel); } void GitPlugin::startChangeRelatedAction() diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 9022b65c2163b0c619e1cbe68224131746a7a2de..c572e5d542038fb8e11988902f833404ee2d2b50 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -405,15 +405,6 @@ QString VcsBasePluginState::topLevel() const return hasFile() ? data->m_state.currentFileTopLevel : data->m_state.currentProjectTopLevel; } -QString VcsBasePluginState::currentDirectoryOrTopLevel() const -{ - if (hasFile()) - return data->m_state.currentFileDirectory; - else if (data->m_state.hasProject()) - return data->m_state.currentProjectTopLevel; - return QString(); -} - bool VcsBasePluginState::equals(const Internal::State &rhs) const { return data->m_state.equals(rhs); diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 630f1d907a5f0dce82503de056c8b48f2c049e80..092d4be727f1190c7927f454c353b13a6dc9dc96 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -102,7 +102,6 @@ public: // the file one. QString topLevel() const; - QString currentDirectoryOrTopLevel() const; bool equals(const VcsBasePluginState &rhs) const; friend VCSBASE_EXPORT QDebug operator<<(QDebug in, const VcsBasePluginState &state);