Skip to content

fix $HOME detection on windows #800

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

Merged
merged 2 commits into from
Mar 30, 2023
Merged

fix $HOME detection on windows #800

merged 2 commits into from
Mar 30, 2023

Conversation

pascalkuthe
Copy link
Contributor

@pascalkuthe pascalkuthe commented Mar 30, 2023

Fixes helix-editor/helix#6467

Git manually fixes up the $HOME environment variable in compat/mingw.c because it is not set on windows (unless running inside unix emulation like git bash). This PR replaces all calls to std::env::var_os("HOME") with a function
that matches the git implementation. Note that this is not necessarily the best $HOME detection on windows (for example $HOMESHARE is not considered). I purposefully exactly matched the git implementation here for compatibility.


Ok for Byron review the PR on video?

  • I give my permission to record review and upload on YouTube publicly

If I think the review will be helpful for the community, then I might record and publish a video.

- move `env_var` to path as it's the smaller crate that is easier to pull in from other plumbing crates.
- use fully qualified paths to make clearer what is what.
- add at least 'some' test for `gix_path::home_dir()`
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for fixing for this particularly subtle (and thus intractable) problem!

I will merge and create a new release once CI is green.

@Byron Byron merged commit d47cebe into GitoxideLabs:main Mar 30, 2023
@Byron
Copy link
Member

Byron commented Mar 30, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

does not recognize git global core.autocrlf = input settings on windows, causing diff gutter problems
2 participants