anishathalye / anishathalye/dotbot

Clean directive does not clean everything

未關閉
#392 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
8k
分支
320
PR 合併指標
30 天內沒有已合併 PR

描述

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: https://github.com/dorinclisu/dotbot/commit/0c6517323ce43cc6d2557eca78a7e767d254b853

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.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。