git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Document HOME environment variable

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 9, 2024, 23:47 UTC
Message-ID
<xmqqwmg8mnab.fsf@gitster.g>
In-Reply-To
<pull.1834.git.1733771894867.gitgitgadget@gmail.com>
"M Hickford via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> From: Alejandro Barreto <alejandro.barreto@ni.com>
>
> 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.
Show 7 quoted lines
> +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.
Previous: M Hickford via GitGitGadgetNext: Johannes Sixt
Message 2 of 4 in “Document HOME environment variable”
  1. Document HOME environment variableM Hickford via GitGitGadget, Dec 9, 2024
  2. Junio C HamanoDec 9, 2024
  3. Johannes SixtDec 10, 2024
  4. Junio C HamanoDec 10, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.