mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 16:21:15 -03:00
normalize_path: Squash leading slashes even without allow_leading
This currently changes builtin realpath with the "-s" option:
builtin realpath -s ///tmp
previously would print "///tmp", now it prints "/tmp".
The only thing "allow_leading_double_slashes" does is allow *two*
slashes.
This is important for `path match`, to be introduced in #8265.
This commit is contained in:
@@ -95,6 +95,15 @@ else
|
||||
echo "failure nonexistent-file-relative-to-a-symlink: $real_path != $expected_real_path" >&2
|
||||
end
|
||||
|
||||
# We remove leading slashes even with "-s".
|
||||
# This is how GNU realpath -s behaves, and also e.g.
|
||||
# how bash normalizes its $PWD.
|
||||
builtin realpath -s ///bin
|
||||
# CHECK: /bin
|
||||
|
||||
builtin realpath -s //bin
|
||||
# CHECK: /bin
|
||||
|
||||
# A path with two symlinks, first to a directory, second to a file, is correctly resolved.
|
||||
ln -fs fish $XDG_DATA_HOME/fish-symlink2
|
||||
touch $XDG_DATA_HOME/fish/real_file
|
||||
|
||||
Reference in New Issue
Block a user