diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2013-07-09 23:43:14 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2013-07-10 12:51:06 +0200 |
commit | 3eacb444e910f02f84734cc7141daa97e50556be (patch) | |
tree | dbc00f7b0613f26140c2c6d0a41e6c39bd0cf864 /src/plugins/git | |
parent | 372fc608dfa78e6f9560e5049794095762b26751 (diff) | |
download | qt-creator-3eacb444e910f02f84734cc7141daa97e50556be.tar.gz |
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>
Diffstat (limited to 'src/plugins/git')
-rw-r--r-- | src/plugins/git/branchmodel.cpp | 17 | ||||
-rw-r--r-- | src/plugins/git/gitclient.cpp | 3 |
2 files changed, 3 insertions, 17 deletions
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 4d577597f1..791b7b9606 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -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) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index bb365dd1a0..fe3a6ee882 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1271,7 +1271,8 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory, QByteArray errorText; QStringList arguments; arguments << QLatin1String("checkout") << ref; - const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText); + const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText, + VcsBasePlugin::ExpectRepoChanges); const QString output = commandOutputFromLocal8Bit(outputText); outputWindow()->append(output); if (!rc) { |