-
Notifications
You must be signed in to change notification settings - Fork 2.7k
The readlink() function should be independent of core.symlinks #622
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
The readlink() function should be independent of core.symlinks #622
Conversation
Please format the commit message according to https://github.com/git-for-windows/git/blob/master/Documentation/SubmittingPatches (including the Sign-off). However, I am not sure that this patch is a good idea. If we do not write symlinks, we should not read them, either. Otherwise a caller might be tempted to try to recreate a symlink, read it, and then fail to write it. Also, |
fc14913
to
58c2476
Compare
Core api command readlink() was depending on a git configuration specific setting of has_symlinks to decide whether it should attempt to return the target of a symlink. It should be up to the caller to check whether symlinks are enabled not up to the api command readlink(). If a caller wants to get a symlink target, then it should get it regardless of whether symlinks are configured in git's core.symlinks setting. Signed-off-by: Rick Burgstaler <[email protected]>
58c2476
to
ea94df0
Compare
I have updated the commit message. Hopefully it is now closer to the desired format. So the way that I understand it the purpose behind mingw.c is to fill the missing gaps between what is supported in vanilla mingw and what the git code-base needs. mingw.c has a method symlink() which I am assuming is meant to implement http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html just like readlink() located in mingw.c is meant to implement http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html. The problem is that readlink() and symlink() both (before my patch) currently require a check on has_symlinks which is a git specific setting set via core.symlinks. My thoughts are that readlink() and symlink() should not care about a git specific configuration setting (has_symlinks and/or core.symlinks). They should do their job as instructed and return the result if possible (of course we all know about he admin rights requirements and the OS limitation of XP and greater to create/use symlinks). So I guess I am suggesting also to revise this patch to also remove the has_symlinks check from the symlinks() method as well. I guess the million $$$$ question is, does removing has_symlinks form symlinks() and readlink() break some other expected behavior in git-for-windows. If so I would look into finding an approach to resolving that. I do know that having has_symlinks breaks my I have looked at
Truthfully, I have not looked deep enough into what the shortcomings are with submodules in worktree yet so it might actually work for us/me. My intentions here were mainly to help identify a bug and possibly help to resolve it. After all this functionality worked before some commits from May of 2015 so I see it as a fix to a regression. |
The problem is: it cannot implement this. There is no precise equivalent in Windows for POSIX-style symbolic links. See https://github.com/git-for-windows/git/wiki/Symbolic-Links That is the reason why we require users to turn on the
I am sure that Git would benefit if you started working on this. |
Just wanted to summarize quickly, Looking at
From this it appears as though core.symlinks refers to case (2.) from above and does NOT really refer to case (1.) from above In the case of git-for-windows, it has been determined by the git-for-windows community that setting core.symlinks to false will make case (1.) and (2.) not realize symlinks. Essentially no support for symlinks what so ever (even if needed by core git for non-repo operations). With
You have convinced me that if I want git-new-workdir to work for now, I will As for git-new-workdir, I will start moving to the future with worktree, but I did/do have an immediate need with 50 repos that each member of a team of developers uses that need git-new-workdir to work properly and not blow away packed-refs. core.symlinks set to true will be the work around until I can get completely moved to worktree on the 50 repos and update these for everybody on the team. Thanks for your time, |
Thanks for understanding. If you face any problems with worktree, I would like to encourage you to bring these problems up on the upstream Git mailing list. I, for one, will keep an eye out and try to assist with resolving those issues. |
This patch was motivated by a bug that was discovered: when calling git pack-refs --all in a working directory created via git-new-workdir, it will blow away the existing .git\packed-refs symlink that points to the source directory and replace packed-refs with a regular file with duplicate refs in it. This patch fixes this.
Fix: readlink() not returning target symlink when it is desired
Core api command readlink() was depending on a git configuration specific setting of has_symlinks to decide whether it should attempt to return the target of a symlink. It should be up to the caller to check whether symlink are enabled not up to the api command readlink(). If a caller wants to get a symlink target, then it should get it regardless of whether symlinks are configured in git.
This item is related to:
#220
and
#186
and
#225