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; }