After running dotbot -c dotbot.yml, I get the following
$ dotbot -c dotbot.yml
Creating link t_target -> /home/user/test/t_source
All links have been set up
==> All tasks executed successfully
$ ls -l
-rw-rw-r-- 1 user user 110 Mar 21 22:48 dotbot.yml
drwxrwxr-x 2 user user 4096 Mar 21 22:47 t_source/
lrwxrwxrwx 1 user user 27 Mar 21 22:50 t_target -> /home/user/test/t_source/
$ ls t_target
config.json
Now, I wanted to change my config to instead link the file directly (config.json) instead of the directory (t_source).
t_target/config.jsonexists since we previously linked it.
So when dotbot goes to link this file, it sees that t_target/config.json exists and deletes it to make room for the new link. Since this points to the real original file, t_source/config.json is deleted!
$ ls t_source/config.json
t_source/config.json
$ dotbot -c dotbot.yml
Removing t_target/config.json
Nonexistent source for t_target/config.json : /home/user/test/t_source/config.json
Some links were not successfully set up
==> Some tasks were not executed successfully
$ ls t_source/config.json
ls: cannot access 't_source/config.json': No such file or directory
This is fundamentally user error, but I think it's worth putting some checks around since not only did it delete my source file, but it wasn't clear why it did it until I took some time to investigate.
While configuring my dotbot config, I ran into an issue that caught me off guard and led to the accidental deletion of source files.
After running
dotbot -c dotbot.yml
, I get the followingNow, I wanted to change my config to instead link the file directly (
config.json
) instead of the directory (t_source
).Here is where the issue lies. Remember:
t_target
is a symlink pointing tot_source
t_target/config.json
exists since we previously linked it.So when dotbot goes to link this file, it sees that
t_target/config.json
exists and deletes it to make room for the new link. Since this points to the real original file,t_source/config.json
is deleted!This is fundamentally user error, but I think it's worth putting some checks around since not only did it delete my source file, but it wasn't clear why it did it until I took some time to investigate.