summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/git/gitclient.cpp16
-rw-r--r--src/plugins/git/gitclient.h3
-rw-r--r--src/plugins/git/stashdialog.cpp18
3 files changed, 10 insertions, 27 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index ac047f0ac7..dfc9e7af16 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 f21a148672..69709b9030 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 fecdedddd8..153173e4b3 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);
}
}