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

Re: [PATCH v2 0/2] mingw: handle absolute paths in expand_user_path()

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2021, 17:42 UTC
Message-ID
<xmqq1r8irkvk.fsf@gitster.g>
In-Reply-To
<pull.66.v2.git.1625155388.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 13 quoted lines
> In Git for Windows, we ran with a patch "in production" for quite a while
> where paths starting with a slash (i.e. looking like Unix paths, not like
> Windows paths) were interpreted as being relative to the runtime prefix,
> when expanded via expand_user_path().
>
> This was sent to the Git mailing list as a discussion starter, and it was
> pointed out that this is neither portable nor unambiguous.
>
> After the dust settled, I thought about the presented ideas for a while
> (quite a while...), and ended up with the following: any path starting with
> <RUNTIME-PREFIX>/ is expanded. This is ambiguous because it could be a valid
> path. But then, it is unlikely, and if someone really wants to specify such
> a path, it is easy to slap a ./ in front and they're done.
I just went back to briefly scan the discussion in late 2018.
I think the rough consensus back then was that 
 * It indeed is a problem that there is no syntax for users of
   "relocatable Git" to use to point at things that come as part of
   the "relocatable Git" package.
 * A change to expand_user_path() would be too broad, it makes sense
   for this feature to be in git_config_pathname();
 * We need to get the syntax right.
As to the last item, there were a handful of choices raised:
 - Use "~~"--the downside is that this is not extensible.  Use
   "~runtime-prefix/" would be a better choice (the likelyhood of
   <RUNTIME-PREFIX>, $RUNTIME_PREFIX, and any other random choice
   happens to be used as a valid directory name is just as slim as
   the likelyhood of "runtime-prefix" used as a valid username).
 - "$RUNTIME_PREFIX" to make it read like a variable---the downside
   was that it looked TOO MUCH like a variable and risked user
   confusion (e.g. it may be upsetting that "$HOME/.gitconfig" is
   not expanded like "~/.gitconfig" is).
 - %(RUNTIME-PREFIX) to make it similar to how Git replaces various
   tokens that are understood only in the context of Git.
 - <RUNTIME-PREFIX>---the downside is that this is an unnecessary
   new syntax we do not have to introduce.  If <RUNTIME-PREFIX> is
   unlikely to be used as a valid directory name, %(RUNTIME-PREFIX)
   is just as unlikely.

There might have been other ideas floated back then. I have to say that the one you chose in this round is the least favourite of mine, and if you consulted me privately before redoing this round, I would probably have said %(RUNTIME_PREFIX) would make the most sense among the candidates.

Thanks.
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 38 of 53 in “mingw: handle absolute paths in expand_user_path()”
  1. 0/1 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Nov 6, 2018
  2. 1/1 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Nov 6, 2018
  3. Ramsay JonesNov 6, 2018
  4. Ramsay JonesNov 6, 2018
  5. Duy NguyenNov 6, 2018
  6. Junio C HamanoNov 7, 2018
  7. Johannes SchindelinNov 7, 2018
  8. Ramsay JonesNov 7, 2018
  9. Junio C HamanoNov 8, 2018
  10. Johannes SchindelinNov 8, 2018
  11. Junio C HamanoNov 8, 2018
  12. Johannes SchindelinNov 8, 2018
  13. Joseph MoisanNov 9, 2018
  14. Jeff KingNov 9, 2018
  15. Duy NguyenNov 6, 2018
  16. Johannes SchindelinNov 7, 2018
  17. Johannes SixtNov 6, 2018
  18. Johannes SchindelinNov 7, 2018
  19. Johannes SixtNov 7, 2018
  20. Jeff KingNov 7, 2018
  21. Johannes SixtNov 7, 2018
  22. Jeff KingNov 7, 2018
  23. Junio C HamanoNov 8, 2018
  24. Jeff KingNov 8, 2018
  25. Junio C HamanoNov 8, 2018
  26. Johannes SchindelinNov 8, 2018
  27. Duy NguyenNov 8, 2018
  28. Johannes SchindelinNov 8, 2018
  29. Eric SunshineNov 8, 2018
  30. Jeff KingNov 9, 2018
  31. Duy NguyenNov 9, 2018
  32. Junio C HamanoNov 12, 2018
  33. Junio C HamanoNov 8, 2018
  34. Johannes SchindelinNov 8, 2018
  35. 0/2 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Jul 1, 2021
  36. 1/2 tests: exercise the RUNTIME_PREFIX featureJohannes Schindelin via GitGitGadget, Jul 1, 2021
  37. 2/2 expand_user_path(): support specifying paths relative to the runtime prefixJohannes Schindelin via GitGitGadget, Jul 1, 2021
  38. Junio C HamanoJul 1, 2021
  39. 0/5 mingw: handle absolute paths in expand_user_path()Johannes Schindelin via GitGitGadget, Jul 24, 2021
  40. 1/5 tests: exercise the RUNTIME_PREFIX featureJohannes Schindelin via GitGitGadget, Jul 24, 2021
  41. 3/5 expand_user_path(): clarify the role of the `real_home` parameterJohannes Schindelin via GitGitGadget, Jul 24, 2021
  42. 4/5 Use a better name for the function interpolating pathsJohannes Schindelin via GitGitGadget, Jul 24, 2021
  43. Junio C HamanoJul 26, 2021
  44. Fabian StelzerJul 27, 2021
  45. Junio C HamanoJul 27, 2021
  46. Junio C HamanoJul 28, 2021
  47. Junio C HamanoJul 28, 2021
  48. Junio C HamanoJul 28, 2021
  49. Fabian StelzerJul 28, 2021
  50. Junio C HamanoJul 28, 2021
  51. 2/5 expand_user_path(): remove stale part of the commentJohannes Schindelin via GitGitGadget, Jul 24, 2021
  52. 5/5 interpolate_path(): allow specifying paths relative to the runtime prefixJohannes Schindelin via GitGitGadget, Jul 24, 2021
  53. Junio C HamanoJul 26, 2021

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.