{"thread":{"id":"62620","subject":"[PATCH] Document HOME environment variable","startedAt":"2024-12-09T19:18:17Z","lastAt":"2024-12-10T09:21:01Z","messageCount":4,"participants":["M Hickford via GitGitGadget","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"508884","messageId":"pull.1834.git.1733771894867.gitgitgadget@gmail.com","threadId":"62620","inReplyTo":null,"subject":"[PATCH] Document HOME environment variable","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-12-09T19:18:14Z","receivedAt":"2024-12-09T19:18:17Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: Alejandro Barreto <alejandro.barreto@ni.com>\n\nGit documentation refers to $HOME and $XDG_CONFIG_HOME often, but does\nnot specify how or where these values come from on Windows where neither\nis set by default. The new documentation reflects the behavior of\nsetup_windows_environment() in compat/mingw.c.\n\nSigned-off-by: Alejandro Barreto <alejandro.barreto@ni.com>\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    Document how $HOME is set on Windows\n    \n    CC: Alejandro Barreto alejandro.barreto@ni.com, Johannes Schindelin\n    johannes.schindelin@gmx.de\n    \n    Fixes https://github.com/git-for-windows/git/issues/5282\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1834%2Fhickford%2Fhome-docs-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1834/hickford/home-docs-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1834\n\n Documentation/git.txt | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex d15a8697625..47509c9e1a3 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -477,6 +477,14 @@ their values the same way as Boolean valued configuration variables, e.g.\n \n Here are the variables:\n \n+System\n+~~~~~~~~~~~~~~~~~~\n+`HOME`::\n+\tSpecifies the path to the user's home directory. On Windows, if\n+\tunset, Git will set a process environment variable equal to:\n+\t`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;\n+\totherwise `$USERPROFILE` if `$USERPROFILE` exists.\n+\n The Git Repository\n ~~~~~~~~~~~~~~~~~~\n These environment variables apply to 'all' core Git commands. Nb: it\n\nbase-commit: cc01bad4a9f566cf4453c7edd6b433851b0835e2\n-- \ngitgitgadget\n"},{"id":"508893","messageId":"xmqqwmg8mnab.fsf@gitster.g","threadId":"62620","inReplyTo":"pull.1834.git.1733771894867.gitgitgadget@gmail.com","subject":"Re: [PATCH] Document HOME environment variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-12-09T23:47:40Z","receivedAt":"2024-12-09T23:47:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"M Hickford via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Alejandro Barreto <alejandro.barreto@ni.com>\n>\n> Git documentation refers to $HOME and $XDG_CONFIG_HOME often, but does\n> not specify how or where these values come from on Windows where neither\n> is set by default. The new documentation reflects the behavior of\n> setup_windows_environment() in compat/mingw.c.\n\nMakes sense.  As long as the logic to make this fallback is in my\ntree (as opposed to being implemented by a set of GfW/minGit add-on\npatches), its documentation should also be in my tree.\n\nWill queue.\n\n> +System\n> +~~~~~~~~~~~~~~~~~~\n> +`HOME`::\n> +\tSpecifies the path to the user's home directory. On Windows, if\n> +\tunset, Git will set a process environment variable equal to:\n> +\t`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;\n> +\totherwise `$USERPROFILE` if `$USERPROFILE` exists.\n\nI wondered what the reaction by the readers on non-Windows would be,\nbut hopefully they would read this to mean that HOME will not be\nmucked with, even if they leave it unset (or they take it granted\nthat HOME is set somewhere while they log in and they do not have to\nworry about it), so it may be OK.\n\nJust out of curiousity, is Git the only thing that uses $HOME on\nWindows?  Or among may other programs on Windows that use $HOME, is\nthe way Git gives a fall-back value out of these three variables\nunusual and deserves documentation?\n\nThanks.\n"},{"id":"508903","messageId":"a337ef76-096b-4995-ac06-d1be3b34750d@kdbg.org","threadId":"62620","inReplyTo":"xmqqwmg8mnab.fsf@gitster.g","subject":"Re: [PATCH] Document HOME environment variable","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2024-12-10T08:01:57Z","receivedAt":"2024-12-10T08:42:37Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.12.24 um 00:47 schrieb Junio C Hamano:\n> \"M Hickford via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n>> From: Alejandro Barreto <alejandro.barreto@ni.com>\n>> +System\n>> +~~~~~~~~~~~~~~~~~~\n>> +`HOME`::\n>> +\tSpecifies the path to the user's home directory. On Windows, if\n>> +\tunset, Git will set a process environment variable equal to:\n>> +\t`$HOMEDRIVE$HOMEPATH` if both `$HOMEDRIVE` and `$HOMEPATH` exist;\n>> +\totherwise `$USERPROFILE` if `$USERPROFILE` exists.\n\nMakes sense and matches the implementation in compat/mingw.c. GfW uses\nthe same method with with additional checks for existence of the\n$HOMEDRIVE$HOMEPATH combination.\n\n> I wondered what the reaction by the readers on non-Windows would be,\n> but hopefully they would read this to mean that HOME will not be\n> mucked with, even if they leave it unset (or they take it granted\n> that HOME is set somewhere while they log in and they do not have to\n> worry about it), so it may be OK.\n\nSince all Windows specific text is in a single sentence, I think it is\ndifficult to misread. I would leave away the colon, though.\n\n> Just out of curiousity, is Git the only thing that uses $HOME on\n> Windows?  Or among may other programs on Windows that use $HOME, is\n> the way Git gives a fall-back value out of these three variables\n> unusual and deserves documentation?\n\nNo Windows native program uses $HOME. Only POSIX-derived tools would\nconsider doing so. So, I would answer your question: yes, Git is the\n\"only\" one insisting in HOME being set. We are free to choose how we set\nit, and the way we do it makes the most sense for Git's purpose. It is\ncertainly useful to document how we do it.\n\n-- Hannes\n\n"},{"id":"508904","messageId":"xmqqv7vrlwqt.fsf@gitster.g","threadId":"62620","inReplyTo":"a337ef76-096b-4995-ac06-d1be3b34750d@kdbg.org","subject":"Re: [PATCH] Document HOME environment variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-12-10T09:20:58Z","receivedAt":"2024-12-10T09:21:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n>> Just out of curiousity, is Git the only thing that uses $HOME on\n>> Windows?  Or among may other programs on Windows that use $HOME, is\n>> the way Git gives a fall-back value out of these three variables\n>> unusual and deserves documentation?\n>\n> No Windows native program uses $HOME. Only POSIX-derived tools would\n> consider doing so. So, I would answer your question: yes, Git is the\n> \"only\" one insisting in HOME being set. We are free to choose how we set\n> it, and the way we do it makes the most sense for Git's purpose. It is\n> certainly useful to document how we do it.\n\nThat's perfect.  I've marked the topic for 'next' already.\n\nThanks, all.\n\n\n"}]}