First of all, I read https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks#how-can-i-have-different-groups-of-tasks-for-different-hosts-with-different-configurations but there's one problem not mentioned anywhere:
What happens when we change the profile / config on a machine and we have symlinks left over (not included in the current link directives)?
I would expect that clean: ["~"] would take care of that, but it doesn't! Clean only cleans dead symlinks! But if we install a different profile, there's nothing dead as all our source files are there in our dotfiles repository.
This is actually not a source code bug, because the code works exactly like the documentation. Yes, using force: true does not really change anything because the doc says "force | Remove dead links even if they don't point to a file inside the dotfiles
directory (default: false)" so actually I'm arguing that the intent here is wrong.
We actually want to clean ALL leftover symlinks that are no longer explicitly linked. Is there any realistic scenario in which we would like to keep them, that is not already satisfied by using the built-in filter for clean?
Moving forward, to make dotbot actually behave properly for my multiple machine/os setup, I made this modification in the clean logic: dorinclisu@0c65173
What do you think? I can submit a PR with one of these variants:
- Modify the behavior exactly like in my fork commit.
- Add another config key such as "managed" and perform the clean when true, default=false. The advantage of this would be full backwards compatibility and allow opt-in, but it may unnecessarily increase complexity if nobody is abusing the current behavior.
First of all, I read https://github.com/anishathalye/dotbot/wiki/Tips-and-Tricks#how-can-i-have-different-groups-of-tasks-for-different-hosts-with-different-configurations but there's one problem not mentioned anywhere:
What happens when we change the profile / config on a machine and we have symlinks left over (not included in the current link directives)?
I would expect that
clean: ["~"]would take care of that, but it doesn't! Clean only cleans dead symlinks! But if we install a different profile, there's nothing dead as all our source files are there in our dotfiles repository.This is actually not a source code bug, because the code works exactly like the documentation. Yes, using
force: truedoes not really change anything because the doc says "force | Remove dead links even if they don't point to a file inside the dotfilesdirectory (default: false)" so actually I'm arguing that the intent here is wrong.
We actually want to clean ALL leftover symlinks that are no longer explicitly linked. Is there any realistic scenario in which we would like to keep them, that is not already satisfied by using the built-in filter for clean?
Moving forward, to make dotbot actually behave properly for my multiple machine/os setup, I made this modification in the clean logic: dorinclisu@0c65173
What do you think? I can submit a PR with one of these variants: