Don't resolve symlinks with cd - #5190
Conversation
|
The hg prompt will need adjustment after this. Because hg is sooooo slow, we check if something can possibly be a hg repo by seeing if there is a ".hg" directory in any parent directory: # Find an hg directory above $PWD
# without calling `hg root` because that's too slow
set -l root
set -l dir $PWD
while test $dir != "/"
if test -f $dir'/.hg/dirstate'
set root $dir"/.hg"
break
end
# Go up one directory
set dir (string replace -r '[^/]*/?$' '' $dir)
endIf $PWD is "virtual", then that means we'd follow symlinks back. hg won't, so we'd have to use the "physical" pwd here. I would assume basically any work done on $PWD will want to switch to the physical one, which makes me think: Why don't we still keep that as physical, and just offer a separate $LOGICAL_PWD (and |
|
I think I'm not strongly attached to the existing behaviour, but I think it's worth noting somewhere in the |
|
@zanchey not exactly.
The paths are symbolically linked to the NT namespace path in the registry, but that's not a file-level symbolic link but rather a device/volume-level symbolic link that is a layer or two of abstraction apart from the filesystem. Much more info here: https://blogs.msdn.microsoft.com/jeremykuhne/2016/05/02/dos-to-nt-a-paths-journey/ |
|
I would like this change, if not the default at least should be configurable although looking at the PR I can see it'd be somewhat messy to implement like so. A lot of shell apps are built around standard One use case where fish's default behaviour breaks user flow. When working in Golang, it expects all your projects and their dependencies to live in |
08004e6 to
f49ecf5
Compare
This new function performs normalization of paths including dropping /./ segments, and resolving /../ segments, in preparation for switching fish to a "virtual" PWD.
This switches fish to a "virtual" PWD, where it no longer uses getcwd to discover its PWD but instead synthesizes it based on normalizing cd against the $PWD variable. Both pwd and $PWD contain the virtual path. pwd is taught about -P to return the physical path, and -L the logical path (which is the default). Fixes fish-shell#3350
The hg prompt walks up the directory hierarchy to decide if we are in a repo subdirectory. Because hg is an external command, it resolves symlinks. Switch to using pwd -P so hg and fish will have the same view of the hg repo. Based on comment: fish-shell#5190 (comment)
f49ecf5 to
3e4bdf5
Compare
|
Merged as 786c0c5 |
The hg prompt walks up the directory hierarchy to decide if we are in a repo subdirectory. Because hg is an external command, it resolves symlinks. Switch to using pwd -P so hg and fish will have the same view of the hg repo. Based on comment: fish-shell#5190 (comment)
The hg prompt walks up the directory hierarchy to decide if we are in a repo subdirectory. Because hg is an external command, it resolves symlinks. Switch to using pwd -P so hg and fish will have the same view of the hg repo. Based on comment: fish-shell#5190 (comment)
The hg prompt walks up the directory hierarchy to decide if we are in a repo subdirectory. Because hg is an external command, it resolves symlinks. Switch to using pwd -P so hg and fish will have the same view of the hg repo. Based on comment: fish-shell#5190 (comment)
The hg prompt walks up the directory hierarchy to decide if we are in a repo subdirectory. Because hg is an external command, it resolves symlinks. Switch to using pwd -P so hg and fish will have the same view of the hg repo. Based on comment: fish-shell#5190 (comment)
|
I'd noticed this change after upgrading my fish shell today. Since symlinks are no longer being resolved, the "jump" plugin shows the path of the symlink. The argument whether this is desired behavior or not isn't one I want to get into (nor am I qualified to), but for anybody else who just wants their jump plugin to resolve the symlinked path, a quick fix is to add the following line to |
This teaches fish to maintain a virtual PWD, similar to other shells. It no longer resolves symlinks. #3350 for more.
pwd -Pcan be used to access the physical (resolved) working directory. This is part of the shell spec.(This ended up being pretty straightforward.)
This PR is an opportunity for discussion / pushback.