Commit 2af4c05b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Use -x for cherry-pick

Change-Id: Iaa6bfdaa1307a3c7a73fd80fb0ffe3b80a01312d
Reviewed-by: default avatarTobias Hunger <>
parent aad68917
......@@ -1787,6 +1787,17 @@ void GitClient::synchronousTagsForCommit(const QString &workingDirectory, const
bool GitClient::isRemoteCommit(const QString &workingDirectory, const QString &commit)
QStringList arguments;
QByteArray outputText;
arguments << QLatin1String("branch") << QLatin1String("-r")
<< QLatin1String("--contains") << commit;
fullySynchronousGit(workingDirectory, arguments, &outputText, 0,
return !outputText.isEmpty();
// Format an entry in a one-liner for selection list using git log.
QString GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
const QString &format)
......@@ -3167,13 +3178,16 @@ bool GitClient::synchronousRevert(const QString &workingDirectory, const QString
bool GitClient::synchronousCherryPick(const QString &workingDirectory, const QString &commit)
QStringList arguments;
const QString command = QLatin1String("cherry-pick");
// Do not stash if --continue or --abort is given as the commit
if (!commit.startsWith(QLatin1Char('-')) && !beginStashScope(workingDirectory, command))
// "commit" might be --continue or --abort
const bool isRealCommit = !commit.startsWith(QLatin1Char('-'));
if (isRealCommit && !beginStashScope(workingDirectory, command))
return false;
arguments << command << commit;
QStringList arguments(command);
if (isRealCommit && isRemoteCommit(workingDirectory, commit))
arguments << QLatin1String("-x");
arguments << commit;
return executeAndHandleConflicts(workingDirectory, arguments, command);
......@@ -235,6 +235,7 @@ public:
QString synchronousTopRevision(const QString &workingDirectory, QString *errorMessage = 0);
void synchronousTagsForCommit(const QString &workingDirectory, const QString &revision,
QByteArray &precedes, QByteArray &follows);
bool isRemoteCommit(const QString &workingDirectory, const QString &commit);
bool cloneRepository(const QString &directory, const QByteArray &url);
QString vcsGetRepositoryURL(const QString &directory);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment