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

Re: [PATCH] Document HOME environment variable

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 10, 2024, 08:01 UTC
Message-ID
<a337ef76-096b-4995-ac06-d1be3b34750d@kdbg.org>
In-Reply-To
<xmqqwmg8mnab.fsf@gitster.g>
Am 10.12.24 um 00:47 schrieb Junio C Hamano:
Show 10 quoted lines
> "M Hickford via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> From: Alejandro Barreto <alejandro.barreto@ni.com>
>> +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.

Show 5 quoted lines
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 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.