Commit 59c729f8 authored by Friedemann Kleint's avatar Friedemann Kleint

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: default avatarEike Ziller <>
Reviewed-by: default avatarTobias Hunger <>
parent 6f276314
......@@ -95,6 +95,12 @@ bool PatchTool::runPatch(const QByteArray &input, const QString &workingDirector
if (!workingDirectory.isEmpty())
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)
Markdown is supported
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