Subject: Re: [PATCH] Document HOME environment variable

From: Junio C Hamano <[email-masked]>
Date: Tue, 10 Dec 2024 08:47:40 +0900

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

> From: Alejandro Barreto <[email-masked]>
>
> 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.