From 6dc4ac60ae05ef0e13bf9cefb14c1be2637666f2 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 6 Dec 2019 11:22:18 -0800 Subject: [PATCH] Use $PWD to retrieve the current directory in __fish_move_last. (command pwd) uses the system's implementation of pwd. At least the GNU coreutils implementation defaults to -P, which resulted in symlinks being expanded when switching between directories with nextd/prevd. --- share/functions/__fish_move_last.fish | 2 +- tests/cd.in | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_move_last.fish b/share/functions/__fish_move_last.fish index 751b3d2a0..0e71046c1 100644 --- a/share/functions/__fish_move_last.fish +++ b/share/functions/__fish_move_last.fish @@ -12,7 +12,7 @@ function __fish_move_last -d "Move the last element of a directory history from end # Append current dir to the end of the destination - set -g (echo $dest) $$dest (command pwd) + set -g (echo $dest) $$dest $PWD set ssrc $$src diff --git a/tests/cd.in b/tests/cd.in index 6ea2c0289..1e84835fc 100644 --- a/tests/cd.in +++ b/tests/cd.in @@ -9,6 +9,8 @@ set real (mktemp -d) set link $base/link ln -s $real $link cd $link +prevd +nextd test "$PWD" = "$link" || echo "\$PWD != \$link:"\n "\$PWD: $PWD"\n "\$link: $link"\n test (pwd) = "$link" || echo "(pwd) != \$link:"\n "\$PWD: "(pwd)\n "\$link: $link"\n test (pwd -P) = "$real" || echo "(pwd -P) != \$real:"\n "\$PWD: $PWD"\n "\$real: $real"\n