diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index ac047f0ac7655a8fbe5ae50502e50c861163c095..dfc9e7af165b366aa98f2b50012e4563ed40e0dc 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -3529,26 +3529,14 @@ void GitClient::stashPop(const QString &workingDirectory) bool GitClient::synchronousStashRestore(const QString &workingDirectory, const QString &stash, bool pop, - const QString &branch /* = QString()*/, - QString *errorMessage) + const QString &branch /* = QString()*/) { QStringList arguments(QLatin1String("stash")); if (branch.isEmpty()) arguments << QLatin1String(pop ? "pop" : "apply") << stash; else arguments << QLatin1String("branch") << branch << stash; - QByteArray outputText; - QByteArray errorText; - const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText, - VcsBasePlugin::ExpectRepoChanges); - if (rc) { - const QString output = commandOutputFromLocal8Bit(outputText); - if (!output.isEmpty()) - outputWindow()->append(output); - } else { - msgCannotRun(arguments, workingDirectory, errorText, errorMessage); - } - return rc; + return executeAndHandleConflicts(workingDirectory, arguments); } bool GitClient::synchronousStashRemove(const QString &workingDirectory, diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index f21a14867281ce0ecee47f22c966d64e3a19e3aa..69709b903064d5442f491ddeffee313a8da269fc 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -197,8 +197,7 @@ public: bool synchronousStashRestore(const QString &workingDirectory, const QString &stash, bool pop = false, - const QString &branch = QString(), - QString *errorMessage = 0); + const QString &branch = QString()); bool synchronousStashRemove(const QString &workingDirectory, const QString &stash = QString(), QString *errorMessage = 0); diff --git a/src/plugins/git/stashdialog.cpp b/src/plugins/git/stashdialog.cpp index fecdedddd852a3d3b6c24e043131836796fa45da..153173e4b3018867c5d7b9775f56b1b59693437f 100644 --- a/src/plugins/git/stashdialog.cpp +++ b/src/plugins/git/stashdialog.cpp @@ -323,12 +323,10 @@ void StashDialog::restoreCurrent() QString name = m_model->at(index).name; // Make sure repository is not modified, restore. The command will // output to window on success. - const bool success = promptForRestore(&name, 0, &errorMessage) - && gitClient()->synchronousStashRestore(m_repository, name, false, QString(), &errorMessage); - if (success) { + if (promptForRestore(&name, 0, &errorMessage) + && gitClient()->synchronousStashRestore(m_repository, name)) { refresh(m_repository, true); // Might have stashed away local changes. - } else { - if (!errorMessage.isEmpty()) + } else if (!errorMessage.isEmpty()) { warning(msgRestoreFailedTitle(name), errorMessage); } } @@ -340,13 +338,11 @@ void StashDialog::restoreCurrentInBranch() QString errorMessage; QString branch; QString name = m_model->at(index).name; - const bool success = promptForRestore(&name, &branch, &errorMessage) - && gitClient()->synchronousStashRestore(m_repository, name, false, branch, &errorMessage); - if (success) { + if (promptForRestore(&name, &branch, &errorMessage) + && gitClient()->synchronousStashRestore(m_repository, name, false, branch)) { refresh(m_repository, true); // git deletes the stash, unfortunately. - } else { - if (!errorMessage.isEmpty()) - warning(msgRestoreFailedTitle(name), errorMessage); + } else if (!errorMessage.isEmpty()) { + warning(msgRestoreFailedTitle(name), errorMessage); } }