From 0d600b0761f7347ae9b2ca61b28e8f21f709a544 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 3 Jan 2022 10:50:25 +0200 Subject: [PATCH] Git: Support HOMEDRIVE/HOMEPATH home directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/git/gitclient.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index c99ef9a348b..91e441ca682 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2223,8 +2223,14 @@ Environment GitClient::processEnvironment() const Environment environment = VcsBaseClientImpl::processEnvironment(); QString gitPath = settings().path.value(); environment.prependOrSetPath(FilePath::fromUserInput(gitPath)); - if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) - environment.set("HOME", QDir::toNativeSeparators(QDir::homePath())); + if (HostOsInfo::isWindowsHost() && settings().winSetHomeEnvironment.value()) { + 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); return environment; }