twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.

Home Page:https://www.chezmoi.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`--follow` and `--recursive` add seem to conflict

Uroc327 opened this issue · comments

Describe the bug

Issuing chezmoi add --follow --recursive abc (the --recursive is there for redundancy) when .abc is a symlink pointing to a directory, only the directory but not it's contents are added the chezmoi.

To reproduce

mkdir -p test
touch test/a
touch test/b
touch test/c
ln -s test abc
chezmoi add --follow --recursive abc
chezmoi managed
# observe that abc/a, abc/b, abc/c, are missing and only abc is managed

Expected behavior

All files a, b, and c should be managed.

As a quick update on this, I did some investigation in this branch. This is definitely a bug in chezmoi, but due to chezmoi's current implementation it's really hard to fix. chezmoi stats the symlink (abc in the example you give) in multiple different places and needs to treat it as a directory for --follow but as a path component for --recursive.