Git: Prevent another crash on checkout

Crash happens if the repository has a submodule with local
changes that requires updating (commit changed between current
branch and new branch)

Since we already refresh for every repo change, just add "expect"
for checkout and remove the code accessing the deleted index.

Change-Id: Ic464129a2f001e017244fdf719b282dcbd9dffa4
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-07-09 23:43:14 +03:00
committed by Orgad Shaneh
parent 372fc608df
commit 3eacb444e9
2 changed files with 3 additions and 17 deletions

View File

@@ -490,22 +490,7 @@ void BranchModel::checkoutBranch(const QModelIndex &idx)
// No StashGuard since this function for now is only used with clean working dir.
// If it is ever used from another place, please add StashGuard here
QString errorMessage;
if (m_client->synchronousCheckout(m_workingDirectory, branch, &errorMessage)) {
if (errorMessage.isEmpty()) {
QModelIndex currentIdx = currentBranch();
if (currentIdx.isValid()) {
m_currentBranch = 0;
emit dataChanged(currentIdx, currentIdx);
}
m_currentBranch = indexToNode(idx);
emit dataChanged(idx, idx);
} else {
refresh(m_workingDirectory, &errorMessage); // not sure all went well... better refresh!
}
}
if (!errorMessage.isEmpty())
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
m_client->synchronousCheckout(m_workingDirectory, branch);
}
bool BranchModel::branchIsMerged(const QModelIndex &idx)