backpac
backpac copied to clipboard
Symbolic links are ignored
If I add path to symbolic link in 'files', than this file will be interpreted as normal original file. Is this behaviour a bug or a feature?
Good question. Up for debate. I assume if you are adding it to the list of files, you want the link to be followed? Let me know if you want it to not be followed.
The behavior is intentionally different from git in this regard, but I'm open to changes if you have cause.
For intance, I have a usecase: I want to add to backpac two files from homedir: .bashrc and .bash_profile that is relatively symlinked to .bashrc. So when I restore these files on fresh system, I expect to see both of them, correctly symliked.
I understand, there is a catch when dealing with symlink files this way: user can accidentally commit symlink file instead of full original file.
I can only suggest two options: 1) tread symlinks like git and add explicit warning that file archived as symlink (in case of the user wants to archive original file output its full path). 2) add the possibility to prefix some paths in files-list with some special character, to mark them for backpac as symbolic link.
Sorry for my messy language, I hope you got the idea.
Let me preface this comment by saying that symlinks are a bit of a bottomless pit, so I really am trying to stay away from implementing special treatment.
I have a similar situation. I use only .profile in my $HOME directory for .bashrc, .zshrc, etc. Everything symlinks against that.
If I were to use backpac to backup my home dir, I'd just backup that single file. I actually use a completely different script to manage my symlinks.
So to summarize, there are three options:
- Ignore symlinks entirely (for instace in the case of a wildcard set of files, ignore any symlinks caught in that pattern)
- Treat them as files (probably not what most users want)
- Record them as special cases.
I'll think about it some more. I have to rev backpac soon, so some change will be made regarding this.
Thank you for keep working on this project. Will glad to see or hear the solution or workaround for this case.