fish-shell/tests/checks/symlink-universal-variables.fish
Ilya Grigoriev 622f2868e1 Fix set -U when fish_variables is a symlink
Previously, `set -U` would overwrite the symlink with a
regular file.

Fixes https://github.com/fish-shell/fish-shell/issues/7466
2021-02-20 14:24:11 -08:00

19 lines
545 B
Fish

#RUN: %fish -C 'set -g fish %fish' %s
begin
set -gx XDG_CONFIG_HOME (mktemp -d)
mkdir -p $XDG_CONFIG_HOME/fish
set -l target_file $XDG_CONFIG_HOME/fish/target_fish_variables
set -l fish_variables $XDG_CONFIG_HOME/fish/fish_variables
echo > $target_file
ln -sf $target_file $fish_variables
$fish -c 'set -U variable value'
if test -L $fish_variables
echo fish_variables is still a symlink
else
echo fish_variables has been overwritten
end
# CHECK: fish_variables is still a symlink
end