-
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
git rev-parse --show-toplevel fails to resolve all junctions #2114
Comments
Hmm. The way I understand junction points is more like a bind mount point. And if you mounted, say, The reason why I say this is that junction points are resolved in the low-level filesystem layer, unlike symbolic links. So I would argue that Git LFS should not resolve junction points, much like it does not resolve bind mounts. |
Junctions are often used as symbolic links to directories in Windows, for several reason:
See: https://docs.microsoft.com/en-us/sysinternals/downloads/junction As using junctions instead of symlinkds was long recommended by Microsoft themselves, I'd argue that I'm surely not the only one doing this, and that you should resolve junctions as well. :-) |
@JFLarvoire Thank you for re-iterating those arguments. Of course, as you might imagine, I am fully aware of that. And let me take the time to re-iterate the really, really important argument that junction points are equivalent to bind mounts, not to symbolic links. |
I don't care if they're real symbolic links or not. |
It is quite clear that you don't care. Since Git for Windows is not your personal pet project, it is however important that it keeps working for pretty much everybody else as well as possible, too. And just because you do not want to acknowledge that junction points are not, in fact, symbolic links (even if they were used as such for a long time due to the absence of real symbolic links) does not make it less of a fact. Junction points are not symbolic links. It would be a mistake to treat them as such. See also this comment by somebody way smarter than you or I: #437 (comment) |
@bk2204 I am starting to come to the conclusion that Git LFS should do its best to treat junction points the same way it would treat bind mounts on Linux: by not resolving them. |
Agreed, the important thing is that all git components resolve paths consistently, and work well together in the presence of junctions, symlinks, and symlinkds. |
@dscho We unfortunately can't do that. The Go function Wikipedia claims that junction points are symbolic links, which is why I opened this issue. WSL represents them that way as well. The Git LFS developers don't typically use Windows, but we would of course like things to be as functional as possible there. We'll put in a change that prevents the underlying issue from reoccurring with an error message, but that won't let users use junctions in this case. We need to produce a path relative to the repo root for locking purposes, and canonicalization is required because Windows is not case-sensitive and paths can have multiple representations. I'm willing to entertain other suggestions as to how to fix this, but canonicalization is definitely required. |
@bk2204 in another ticket about Cygwin symlinks (which are yet a different way to emulate symlinks on Windows), I suggested enhancing the Windows part of We could do the same here (with the caveat that junctions really are not symlinks, so quite a few restrictions apply): implement I will gladly guide any volunteer who wants to implement this. |
@bk2204 Git for Windows was recently switched to use |
Closing this as stale. |
Setup
This is a 64-bit VM
defaults?
Details
Bash
Minimal, Complete, and Verifiable example
this will help us understand the issue.
I expected Git to provide an absolute, canonical path, resolving all junctions (since they are a kind of symlink).
The junction was not resolved:
This happens to cause a problem for Git LFS, because Git LFS does indeed resolve all junctions. However, when relativizing a path based on
git rev-parse --show-toplevel
, which is documented as being absolute, the path that's created doesn't share the proper components in common, leading to locking being broken because the lock path contains..
. This is the cause of git-lfs/git-lfs#3354.The text was updated successfully, but these errors were encountered: