-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HOME environment variable not recognized #2293
Comments
Changes from #685 will only works if you set |
Ok. That seems a little silly. I propose the behavior be changed to include system-wide |
Could the issue lie in the GitCommands/Git/GitCommandHelpers.cs: public static void SetEnvironmentVariable(bool reload = false)
{
string path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
if (!string.IsNullOrEmpty(AppSettings.GitBinDir) && !path.Contains(AppSettings.GitBinDir))
Environment.SetEnvironmentVariable("PATH", string.Concat(path, ";", AppSettings.GitBinDir), EnvironmentVariableTarget.Process);
if (!string.IsNullOrEmpty(AppSettings.CustomHomeDir))
{
Environment.SetEnvironmentVariable(
"HOME",
AppSettings.CustomHomeDir);
return;
}
if (AppSettings.UserProfileHomeDir)
{
Environment.SetEnvironmentVariable(
"HOME",
Environment.GetEnvironmentVariable("USERPROFILE"));
return;
}
if (reload)
{
Environment.SetEnvironmentVariable(
"HOME",
UserHomeDir);
}
//Default!
Environment.SetEnvironmentVariable("HOME", GetDefaultHomeDir());
//to prevent from leaking processes see issue #1092 for details
Environment.SetEnvironmentVariable("TERM", "msys");
string sshAskPass = Path.Combine(AppSettings.GetInstallDir(), @"GitExtSshAskPass.exe");
if (EnvUtils.RunningOnWindows())
{
if (File.Exists(sshAskPass))
Environment.SetEnvironmentVariable("SSH_ASKPASS", sshAskPass);
}
else if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SSH_ASKPASS")))
Environment.SetEnvironmentVariable("SSH_ASKPASS", "ssh-askpass");
} ^ At least on my system, public static string GetHomeDir()
{
return Environment.GetEnvironmentVariable("HOME") ?? "";
}
public static string GetDefaultHomeDir()
{
if (!string.IsNullOrEmpty(UserHomeDir))
return UserHomeDir;
if (EnvUtils.RunningOnWindows())
{
return WindowsDefaultHomeDir;
}
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
private static string WindowsDefaultHomeDir
{
get
{
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HOMEDRIVE")))
{
string homePath = Environment.GetEnvironmentVariable("HOMEDRIVE");
homePath += Environment.GetEnvironmentVariable("HOMEPATH");
return homePath;
}
return Environment.GetEnvironmentVariable("USERPROFILE");
}
} ^ Should |
I don't know. It's very old code.
We can't, because |
The environment variable USERPROFILE is not the same as HOMEDRIVE HOMEPATH. On my system they are different. I wrote the code above to have the same behaviour as the default msysgit behaviour. |
@spdr870 Why GitExt use only user level %HOME%? private static readonly string UserHomeDir = Environment.GetEnvironmentVariable("HOME", EnvironmentVariableTarget.User); |
Not sure. I guess the process level environment variable could not be used, because it is set by gitext. The machine level variable can be used. -------- Oorspronkelijk bericht -------- @spdr870 Why GitExt use only user level %HOME%? private static readonly string UserHomeDir = Environment.GetEnvironmentVariable("HOME", EnvironmentVariableTarget.User); |
When I started GitExtensions 2.47.3 this morning, it prompted me to find my
.gitconfig
file:But I do have a
HOME
environment variable set and it does contain a.gitconfig
:At first, pressing 'Yes' to have GE locate the folder caused it to create a new
.gitconfig
in the directory shown in the dialog (C:\...\pokeeffe.CEE
). After a few iterations deleting that new file, exiting GE and restarting, it finally caught my intended.gitconfig
:But it still does not recognize my
HOME
environment variable:Is this behavior by design? I do see a comment in #685 suggesting the system
HOME
env var is ignored in favor of per-userHOME
vars.The text was updated successfully, but these errors were encountered: