Core: Use "patch" from git on Windows

On my system where I have strawberry perl installed, the "patch.exe"
from strawberry perl is picked.

This patch.exe has issues while reverting chunks, where as git's
patch.exe works perfectly.

Change-Id: I7e8c8f91f0f841c128ff8538dba68bee161a5f7b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Cristian Adam
2023-02-28 17:55:59 +01:00
parent 628babb5cb
commit 00502c4630

View File

@@ -24,9 +24,18 @@ FilePath PatchTool::patchCommand()
QSettings *s = ICore::settings();
s->beginGroup(settingsGroupC);
const FilePath command = FilePath::fromSettings(s->value(patchCommandKeyC, patchCommandDefaultC));
FilePath command = FilePath::fromSettings(s->value(patchCommandKeyC, patchCommandDefaultC));
s->endGroup();
if (HostOsInfo::isWindowsHost() && command.path() == patchCommandDefaultC) {
const QSettings settings(R"(HKEY_LOCAL_MACHINE\SOFTWARE\GitForWindows)",
QSettings::NativeFormat);
const FilePath gitInstall = FilePath::fromUserInput(settings.value("InstallPath").toString());
if (gitInstall.exists())
command = command.searchInPath({gitInstall.pathAppended("usr/bin")},
Utils::FilePath::PrependToPath);
}
return command;
}