-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-do the path interpolation support regarding RUNTIME_PREFIX #3472
Conversation
Originally, we refrained from adding a regression test in 7b6c649 (system_path(): Add prefix computation at runtime if RUNTIME_PREFIX set, 2008-08-10), and in 226c0dd (exec_cmd: RUNTIME_PREFIX on some POSIX systems, 2018-04-10). The reason was that it was deemed too tricky to test. Turns out that it is not tricky to test at all: we simply create a pseudo-root, copy the `git` executable into the `git/` subdirectory of that pseudo-root, then copy a script into the `libexec/git-core/` directory and expect that to be picked up. As long as the trash directory is in a location where binaries can be executed, this works. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
In 395de25 (Expand ~ and ~user in core.excludesfile, commit.template, 2009-11-17), the `user_path()` function was refactored into the `expand_user_path()`. During that refactoring, the `buf` parameter was lost, but the code comment above said function still talks about it. Let's remove that stale part of the comment. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
The `real_home` parameter only has an effect when expanding paths starting with `~/`, not when expanding paths starting with `~<user>/`. Let's make that clear. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
It is not immediately clear what `expand_user_path()` means, so let's rename it to `interpolate_path()`. This also opens the path for interpolating more than just a home directory. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
…efix Ever since Git learned to detect its install location at runtime, there was the slightly awkward problem that it was impossible to specify paths relative to said location. For example, if a version of Git was shipped with custom SSL certificates to use, there was no portable way to specify `http.sslCAInfo`. In Git for Windows, the problem was "solved" for years by interpreting paths starting with a slash as relative to the runtime prefix. However, this is not correct: such paths _are_ legal on Windows, and they are interpreted as absolute paths in the same drive as the current directory. After a lengthy discussion, and an even lengthier time to mull over the problem and its best solution, and then more discussions, we eventually decided to introduce support for the magic sequence `%(prefix)/`. If a path starts with this, the remainder is interpreted as relative to the detected (runtime) prefix. If built without runtime prefix support, Git will simply interpolate the compiled-in prefix. If a user _wants_ to specify a path starting with the magic sequence, they can prefix the magic sequence with `./` and voilà, the path won't be expanded. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
This drops the original patch in preparation for merging the version that made it upstream. Signed-off-by: Johannes Schindelin <[email protected]>
This drops Git for Windows' version in preparation for merging the version that made it upstream, followed by reinstating the now-deprecated handling of a leading slash on Windows. Signed-off-by: Johannes Schindelin <[email protected]>
Let's merge this topic early, as we will have to re-enable our previous magic handling of a leading slash (but now with a deprecation warning). Signed-off-by: Johannes Schindelin <[email protected]>
On Windows, an absolute POSIX path needs to be turned into a Windows one. We used to interpret paths starting with a single `/` as relative to the runtime-prefix, but now these need to be prefixed with `%(prefix)/`. Let's warn for now, but still handle it. Signed-off-by: Johannes Schindelin <[email protected]>
Config settings referring to paths relative to where Git is installed [now have to be marked via `%(prefix)/` instead of the now-deprecated leading slash](git-for-windows/git#3472). Signed-off-by: Johannes Schindelin <[email protected]>
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
@dscho does this influence the git config includes like the tripple slashes in |
It should not. Does it? |
I guess it does: it will probably complain, and the only solution might be to go from triple to double slashes (which should also work). |
Darn it. I fear that it might not be possible to specify this in a backwards-compatible way... :-( didn't think of that. |
Okay let's say I migrate everything to the new version, how would the new format look like? |
I think that it should work with two slashes, but it might not... Maybe going forward, we'll keep treating three slashes as if they were two, and make it work with two slashes at the point when we drop the "treat paths starting with a slash as relative to |
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
Re-do the path interpolation support regarding RUNTIME_PREFIX
For quite some time, Git for Windows supported config settings referring to a path that is relative to the location where Git is installed (the so-called "RUNTIME_PREFIX"). For example, setting
http.sslCAInfo
to/ssl/certs/ca-bundle.crt
would make it expand automatically toC:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt
.When upstreaming this feature, it was decided that this was too limited (it only supported Windows, and since a leading slash indicates a valid absolute path on other platforms, could not be extended to span those platforms, too).
Instead, the value now needs to start with
%(prefix)/
to be expanded in that way.Let's take those patches, but also reinstate Git for Windows' original, now deprecated behavior. For good measure, let's print a warning that this has been deprecated.