From 00502c46300af705ce7fc80846fc62db1f8cb97b Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 28 Feb 2023 17:55:59 +0100 Subject: [PATCH] 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 Reviewed-by: Qt CI Bot --- src/plugins/coreplugin/patchtool.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/patchtool.cpp b/src/plugins/coreplugin/patchtool.cpp index 40493217486..9af08353807 100644 --- a/src/plugins/coreplugin/patchtool.cpp +++ b/src/plugins/coreplugin/patchtool.cpp @@ -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; }