jorgebucaran / fisher

A plugin manager for Fish
https://git.io/fisher
MIT License
7.55k stars 257 forks source link

"update" command restore symlink to normal file #637

Closed kosukemori closed 3 years ago

kosukemori commented 3 years ago

Hi! I'm using mackup, so I change ~/.config/fish/fish_variables as a symlink file. However, fisher update command restores the symlink file to normal file.

For example,

# OS: macOS Big Sur (11.0.1)

# After install fisher, (no need to install mackup for reproducing)
mv ~/.config/fish/fish_variables ~/fish_variables
ln -sfn ~/fish_variables ~/.config/fish/fish_variables
ls -la ~/.config/fish/ # fish_variables is a symlink file

fisher update
ls -la ~/.config/fish/ # fish_variables becomes a normal (not symlink) file

I found that if I comment out the below line, this problem is solved. But I don't know why, because this line only erases an local environmental value... https://github.com/jorgebucaran/fisher/blob/f5b6254833f432101e4deaf7663995fd69a1a4fd/fisher.fish#L134

jorgebucaran commented 3 years ago

@kosukemori Please state your Fish and Fisher version.

kosukemori commented 3 years ago

@jorgebucaran Oh, sorry,

$ fish -v
fish, version 3.1.2

$ fisher --version
fisher, version 4.1.0
jorgebucaran commented 3 years ago

@kosukemori Can one normally create and erase universal variables if fish_variables is as symlink?

kosukemori commented 3 years ago

@jorgebucaran I see, I can create or erase universal variables, but fish_variables always turns from symlink to a normal file. It seems an fish shell's problem.

jorgebucaran commented 3 years ago

@kosukemori Exactly. You can read more about universal variables here.

Universal variables are stored in the file .config/fish/fish_variables. Do not edit this file directly, as your edits may be overwritten. Edit the variables through fish scripts or by using fish interactively instead.

Emphasis is mine.

My suggestion: do not symlink your fish_variables file.

jorgebucaran commented 3 years ago

@kosukemori Or symlink the entire directory. See: https://github.com/fish-shell/fish-shell/issues/7466

kosukemori commented 3 years ago

Thanks @jorgebucaran ! I'll symlink the entire directory by configuring mackup. (Actually mackup's default configuration of fish & fisher seems to be old.)

jorgebucaran commented 3 years ago

@kosukemori You may be interested in https://github.com/fish-shell/fish-shell/pull/7728. 👋

kosukemori commented 3 years ago

@jorgebucaran Thanks! It looks great. I'll try the HEAD version of fish.