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

Re: [PATCH v2 1/3] path: use forward slashes in XDG config on Windows

From
DWDelilah Ashley Wu <delilahwu@linux.microsoft.com>
Date
Sep 10, 2026, 04:48 UTC
Message-ID
<aqIvJhLLcCSnyaL4-delilahwu@linux.microsoft.com>
In-Reply-To
<xmqqecfkhify.fsf@gitster.g>
Thanks for the reviews! I'm still working through the feedback for v3.
On Wed, Aug 26, 2026 at 10:58:57AM +1000, Junio C Hamano wrote:
> Is this "force forwared slashes to Windows users" a required part of
> XDG/HOME global fix?  If not, please leave it out of the topic. [...]
> Again, I do not see it explained why this change has to be part of
> this series in the proposed log message, so...?

Sorry, I forgot to explain in the log message that this change is supposed to supplement the `--show-origin` tests added in patch 3 (config: read global scope via config_sequence). Without it, the `--show-origin` would output a path with mixed slashes on Windows:

    file:"C:\\Users\\delilah/.config/git/config"    xdg.foo=bar

The tests expect paths containing only forward slashes. So patch 3 modifies `t1300-config.sh` assertions to look like this:

    echo "file:$HOME/.config/git/config    xdg.config=xdg" >expect
    git config list --global --show-origin >actual
    test_cmp expect actual

where `$HOME` has been normalised to contain forward slashes only, as seen at `t1300-config.sh:2179`, which was introduced in 45bf329 (t1300: fix the new --show-origin tests on Windows):

    HOME="$(pwd)" # convert to Windows path
Show 7 quoted lines
> Even if it is a good idea to always force forward slashes to Windows
> users (I have no strong opinions on the topic), and if it is very
> unlikely to break existing Windows users (I do not have any clue if
> that would be the case or not, as I do not do Windows), we would
> want to make sure if we can get the same effect without sprinkling
> "#ifdef" in the platform agnostic part of the codebase like "path.c"
> file.

I followed an existing usage of `#ifdef GIT_WINDOWS_NATIVE` and `convert_slashes()` in `path.c`, but if it's no longer allowed in the platform agnostic part, we could do the slash conversion elsewhere. This assumes we want to keep converting the slashes, but we should reconsider from your points raised below.

> Where would the slash in "ret" that is passed to convert_slashes()
> function come from?  If they come from environment variables like
> XDG_CONFIG_HOME and HOME, that is end-user's preference and we have
> no business forcing them which forms of slashes to use.

The slash in `ret` would come from the environment variables, so perhaps we should not modify the slashes in them at all. Instead, I could drop this patch and change the tests in patch 3 to export a `XDG_CONFIG_HOME` value containing only forward slashes. This would satisfy the assumption that paths in the tests will contain only forward slashes. What do you think?

Thanks! Delilah =)

Previous: Junio C HamanoNext: Delilah Ashley Wu
Message 21 of 25 in “config: read both home and xdg files for --global”
  1. 0/4 config: read both home and xdg files for --globalDelilah Ashley Wu via GitGitGadget, Oct 10, 2025
  2. 1/4 cleanup_path: force forward slashes on WindowsDelilah Ashley Wu via GitGitGadget, Oct 10, 2025
  3. Junio C HamanoNov 19, 2025
  4. 2/4 config: test home and xdg files in `list --global`Delilah Ashley Wu via GitGitGadget, Oct 10, 2025
  5. Junio C HamanoNov 19, 2025
  6. 3/4 config: read global scope via config_sequenceDelilah Ashley Wu via GitGitGadget, Oct 10, 2025
  7. Junio C HamanoNov 19, 2025
  8. 4/4 config: keep bailing on unreadable global filesDelilah Ashley Wu via GitGitGadget, Oct 10, 2025
  9. Kristoffer HaugsbakkOct 10, 2025
  10. Delilah Ashley WuNov 22, 2025
  11. Junio C HamanoJan 20, 2026
  12. Johannes SchindelinNov 17, 2025
  13. Junio C HamanoNov 18, 2025
  14. Junio C HamanoNov 19, 2025
  15. Delilah Ashley WuNov 22, 2025
  16. 0/3 config: read both home and xdg files for --globalDelilah Ashley Wu, Aug 23, 2026
  17. 2/3 config: let sequence require a successful fileDelilah Ashley Wu, Aug 23, 2026
  18. Junio C HamanoAug 26, 2026
  19. 1/3 path: use forward slashes in XDG config on WindowsDelilah Ashley Wu, Aug 23, 2026
  20. Junio C HamanoAug 26, 2026
  21. Delilah Ashley WuSep 10, 2026
  22. 3/3 config: read global scope via config_sequenceDelilah Ashley Wu, Aug 23, 2026
  23. Junio C HamanoAug 26, 2026
  24. Chris TorekAug 23, 2026
  25. Junio C HamanoAug 24, 2026

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.