summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-08-28 08:55:15 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-08-28 12:18:56 +0000
commit59c729f8643ff7826c4685e5503f1c713d6e0b25 (patch)
tree0a63d8b12c7d03701a95d2b6fe9841678bea20ed
parent6f2763144b01043374480921ae4c1aa10c365234 (diff)
downloadqt-creator-59c729f8643ff7826c4685e5503f1c713d6e0b25.tar.gz
PatchTool: Enable using git instead of patch.
Git for Windows as of version 2.5 no longer ships patch.exe, which breaks Qt Creator's patching/reverting features. Enhance the PatchTool to be able to use git for this by automatically prepending the 'apply' argument. Change-Id: I5ce98ebc61e2459b855b93b7b33495575170ae99 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r--src/plugins/coreplugin/patchtool.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/patchtool.cpp b/src/plugins/coreplugin/patchtool.cpp
index 098575b325..9224de5ef6 100644
--- a/src/plugins/coreplugin/patchtool.cpp
+++ b/src/plugins/coreplugin/patchtool.cpp
@@ -95,6 +95,12 @@ bool PatchTool::runPatch(const QByteArray &input, const QString &workingDirector
if (!workingDirectory.isEmpty())
patchProcess.setWorkingDirectory(workingDirectory);
QStringList args;
+ // Add argument 'apply' when git is used as patch command since git 2.5/Windows
+ // no longer ships patch.exe.
+ if (patch.endsWith(QLatin1String("git"), Qt::CaseInsensitive)
+ || patch.endsWith(QLatin1String("git.exe"), Qt::CaseInsensitive)) {
+ args << QLatin1String("apply");
+ }
if (strip >= 0)
args << (QLatin1String("-p") + QString::number(strip));
if (reverse)