From cc3f1ad07de7c5d82a61d4efd3394793c1380a38 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh <orgad.shaneh@audiocodes.com> Date: Thu, 28 Feb 2013 13:26:59 +0200 Subject: [PATCH] Git: Run continue command asynchronously Git might request an editor on continue Change-Id: I374e9889e32ea1b1b5ed04f9be9d2a829f3b6440 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Petar Perisin <petar.perisin@gmail.com> --- src/plugins/git/gitclient.cpp | 26 ++++++++++++++++---------- src/plugins/git/gitclient.h | 1 - 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 4d106e2ebd2..90bd390e27f 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1732,10 +1732,23 @@ void GitClient::continuePreviousGitCommand(const QString &workingDirectory, synchronousAbortCommand(workingDirectory, gitCommand); break; default: // Continue/Skip - if (isRebase) - synchronousCommandContinue(workingDirectory, gitCommand, hasChanges); - else + if (isRebase) { + // Git might request an editor, so this must be done asynchronously + // and without timeout + QStringList arguments; + arguments << gitCommand << QLatin1String(hasChanges ? "--continue" : "--skip"); + outputWindow()->appendCommand(workingDirectory, + settings()->stringValue(GitSettings::binaryPathKey), + arguments); + VcsBase::Command *command = createCommand(workingDirectory, 0, true); + command->addJob(arguments, -1); + command->execute(); + ConflictHandler *handler = new ConflictHandler(command, workingDirectory, gitCommand); + connect(command, SIGNAL(outputData(QByteArray)), handler, SLOT(readStdOut(QByteArray))); + connect(command, SIGNAL(errorText(QString)), handler, SLOT(readStdErr(QString))); + } else { GitPlugin::instance()->startCommit(); + } } } @@ -2218,13 +2231,6 @@ bool GitClient::synchronousPull(const QString &workingDirectory, bool rebase) return executeAndHandleConflicts(workingDirectory, arguments, abortCommand); } -bool GitClient::synchronousCommandContinue(const QString &workingDirectory, const QString &command, bool hasChanges) -{ - QStringList arguments; - arguments << command << QLatin1String(hasChanges ? "--continue" : "--skip"); - return executeAndHandleConflicts(workingDirectory, arguments, command); -} - void GitClient::synchronousAbortCommand(const QString &workingDir, const QString &abortCommand) { // Abort to clean if something goes wrong diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index a45452be289..59dd9bb3af5 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -197,7 +197,6 @@ public: QString vcsGetRepositoryURL(const QString &directory); bool synchronousFetch(const QString &workingDirectory, const QString &remote); bool synchronousPull(const QString &workingDirectory, bool rebase); - bool synchronousCommandContinue(const QString &workingDirectory, const QString &command, bool hasChanges); bool synchronousPush(const QString &workingDirectory, const QString &remote = QString()); bool synchronousMerge(const QString &workingDirectory, const QString &branch); bool synchronousRebase(const QString &workingDirectory, -- GitLab