Git: Support HOMEDRIVE/HOMEPATH home directory

MSYS is using %HOMEDRIVE%%HOMEPATH% as home if exists, and falls back to
%USERPROFILE%. So Git settings are supposed to be in HOMEDRIVE on this
case.

Change-Id: Ia15fd30031eedd3e7669e63b265bed83b03518c8
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2022-01-03 10:50:25 +02:00
committed by Orgad Shaneh
parent a2c861beaa
commit 0d600b0761

View File

@@ -2223,8 +2223,14 @@ Environment GitClient::processEnvironment() const
Environment environment = VcsBaseClientImpl::processEnvironment(); Environment environment = VcsBaseClientImpl::processEnvironment();
QString gitPath = settings().path.value(); QString gitPath = settings().path.value();
environment.prependOrSetPath(FilePath::fromUserInput(gitPath)); environment.prependOrSetPath(FilePath::fromUserInput(gitPath));
if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) {
environment.set("HOME", QDir::toNativeSeparators(QDir::homePath())); QString homePath;
if (const char *homeDrive = qgetenv("HOMEDRIVE"))
homePath = QString::fromLocal8Bit(homeDrive) + QString::fromLocal8Bit(qgetenv("HOMEPATH"));
else
homePath = QDir::toNativeSeparators(QDir::homePath());
environment.set("HOME", homePath);
}
environment.set("GIT_EDITOR", m_disableEditor ? "true" : m_gitQtcEditor); environment.set("GIT_EDITOR", m_disableEditor ? "true" : m_gitQtcEditor);
return environment; return environment;
} }