diff options
Diffstat (limited to 'src/plugins/git/branchmodel.cpp')
-rw-r--r-- | src/plugins/git/branchmodel.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 4a0c1af46f..17b2376a67 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -443,18 +443,11 @@ void BranchModel::checkoutBranch(const QModelIndex &idx) if (branch.isEmpty()) return; - QString errorMessage; - switch (m_client->ensureStash(m_workingDirectory, QLatin1String("Branch-Checkout"), true, 0, &errorMessage)) { - case GitClient::StashUnchanged: - case GitClient::Stashed: - case GitClient::NotStashed: - break; - case GitClient::StashCanceled: - return; - case GitClient::StashFailed: - VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage); + GitClient::StashGuard stashGuard(m_workingDirectory, QLatin1String("Branch-Checkout")); + if (stashGuard.stashingFailed(false)) return; - } + stashGuard.preventPop(); + QString errorMessage; if (m_client->synchronousCheckoutBranch(m_workingDirectory, branch, &errorMessage)) { if (errorMessage.isEmpty()) { QModelIndex currentIdx = currentBranch(); |