Skip to content
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

Document how $HOME is set on Windows #1834

Closed
wants to merge 1 commit into from

Conversation

hickford
Copy link

@hickford hickford commented Dec 8, 2024

CC: Alejandro Barreto [email protected], Johannes Schindelin [email protected]

Fixes git-for-windows#5282

cc: Johannes Sixt [email protected]

Copy link

gitgitgadget bot commented Dec 8, 2024

There are issues in commit e98423c:
Document how $HOME is set on Windows
Lines in the body of the commit messages should be wrapped between 60 and 76 characters.
Indented lines, and lines without whitespace, are exempt

Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does
not specify how or where these values come from on Windows where neither
is set by default. The new documentation reflects the behavior of
setup_windows_environment() in compat/mingw.c.

Signed-off-by: Alejandro Barreto <[email protected]>
Signed-off-by: M Hickford <[email protected]>
Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

@hickford maybe you want to add your Signed-off-by line before contributing it to the Git mailing list?

@hickford
Copy link
Author

hickford commented Dec 9, 2024

/submit

Copy link

gitgitgadget bot commented Dec 9, 2024

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1834/hickford/home-docs-v1

To fetch this version to local tag pr-1834/hickford/home-docs-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1834/hickford/home-docs-v1

Copy link

gitgitgadget bot commented Dec 9, 2024

On the Git mailing list, Junio C Hamano wrote (reply to this):

"M Hickford via GitGitGadget" <[email protected]> writes:

> From: Alejandro Barreto <[email protected]>
>
> Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does
> not specify how or where these values come from on Windows where neither
> is set by default. The new documentation reflects the behavior of
> setup_windows_environment() in compat/mingw.c.

Makes sense.  As long as the logic to make this fallback is in my
tree (as opposed to being implemented by a set of GfW/minGit add-on
patches), its documentation should also be in my tree.

Will queue.

> +System
> +~~~~~~~~~~~~~~~~~~
> +`HOME`::
> +	Specifies the path to the user's home directory. On Windows, if
> +	unset, Git will set a process environment variable equal to:
> +	`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
> +	otherwise `$USERPROFILE` if `$USERPROFILE` exists.

I wondered what the reaction by the readers on non-Windows would be,
but hopefully they would read this to mean that HOME will not be
mucked with, even if they leave it unset (or they take it granted
that HOME is set somewhere while they log in and they do not have to
worry about it), so it may be OK.

Just out of curiousity, is Git the only thing that uses $HOME on
Windows?  Or among may other programs on Windows that use $HOME, is
the way Git gives a fall-back value out of these three variables
unusual and deserves documentation?

Thanks.

Copy link

gitgitgadget bot commented Dec 10, 2024

On the Git mailing list, Johannes Sixt wrote (reply to this):

Am 10.12.24 um 00:47 schrieb Junio C Hamano:
> "M Hickford via GitGitGadget" <[email protected]> writes:
> 
>> From: Alejandro Barreto <[email protected]>
>> +System
>> +~~~~~~~~~~~~~~~~~~
>> +`HOME`::
>> +	Specifies the path to the user's home directory. On Windows, if
>> +	unset, Git will set a process environment variable equal to:
>> +	`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;
>> +	otherwise `$USERPROFILE` if `$USERPROFILE` exists.

Makes sense and matches the implementation in compat/mingw.c. GfW uses
the same method with with additional checks for existence of the
$HOMEDRIVE$HOMEPATH combination.

> I wondered what the reaction by the readers on non-Windows would be,
> but hopefully they would read this to mean that HOME will not be
> mucked with, even if they leave it unset (or they take it granted
> that HOME is set somewhere while they log in and they do not have to
> worry about it), so it may be OK.

Since all Windows specific text is in a single sentence, I think it is
difficult to misread. I would leave away the colon, though.

> Just out of curiousity, is Git the only thing that uses $HOME on
> Windows?  Or among may other programs on Windows that use $HOME, is
> the way Git gives a fall-back value out of these three variables
> unusual and deserves documentation?

No Windows native program uses $HOME. Only POSIX-derived tools would
consider doing so. So, I would answer your question: yes, Git is the
"only" one insisting in HOME being set. We are free to choose how we set
it, and the way we do it makes the most sense for Git's purpose. It is
certainly useful to document how we do it.

-- Hannes

Copy link

gitgitgadget bot commented Dec 10, 2024

User Johannes Sixt <[email protected]> has been added to the cc: list.

Copy link

gitgitgadget bot commented Dec 10, 2024

On the Git mailing list, Junio C Hamano wrote (reply to this):

Johannes Sixt <[email protected]> writes:

>> Just out of curiousity, is Git the only thing that uses $HOME on
>> Windows?  Or among may other programs on Windows that use $HOME, is
>> the way Git gives a fall-back value out of these three variables
>> unusual and deserves documentation?
>
> No Windows native program uses $HOME. Only POSIX-derived tools would
> consider doing so. So, I would answer your question: yes, Git is the
> "only" one insisting in HOME being set. We are free to choose how we set
> it, and the way we do it makes the most sense for Git's purpose. It is
> certainly useful to document how we do it.

That's perfect.  I've marked the topic for 'next' already.

Thanks, all.

Copy link

gitgitgadget bot commented Dec 10, 2024

This patch series was integrated into seen via git@f4873e4.

@gitgitgadget gitgitgadget bot added the seen label Dec 10, 2024
Copy link

gitgitgadget bot commented Dec 11, 2024

This patch series was integrated into seen via git@1b78b48.

Copy link

gitgitgadget bot commented Dec 12, 2024

This patch series was integrated into seen via git@b472f51.

Copy link

gitgitgadget bot commented Dec 13, 2024

This patch series was integrated into seen via git@f0b5923.

Copy link

gitgitgadget bot commented Dec 13, 2024

This patch series was integrated into next via git@9f49e6f.

@gitgitgadget gitgitgadget bot added the next label Dec 13, 2024
Copy link

gitgitgadget bot commented Dec 15, 2024

This patch series was integrated into seen via git@87a1b60.

Copy link

gitgitgadget bot commented Dec 16, 2024

This patch series was integrated into seen via git@6a09a9b.

Copy link

gitgitgadget bot commented Dec 16, 2024

This branch is now known as mh/doc-windows-home-env.

Copy link

gitgitgadget bot commented Dec 16, 2024

This patch series was integrated into seen via git@cead366.

Copy link

gitgitgadget bot commented Dec 18, 2024

This patch series was integrated into seen via git@aab3dbf.

Copy link

gitgitgadget bot commented Dec 19, 2024

This patch series was integrated into seen via git@930f2b4.

Copy link

gitgitgadget bot commented Dec 19, 2024

This patch series was integrated into master via git@930f2b4.

Copy link

gitgitgadget bot commented Dec 19, 2024

This patch series was integrated into next via git@930f2b4.

@gitgitgadget gitgitgadget bot added the master label Dec 19, 2024
Copy link

gitgitgadget bot commented Dec 19, 2024

Closed via 930f2b4.

@gitgitgadget gitgitgadget bot closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing documentation upstream? (Document how $HOME is set on Windows)
3 participants