TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
5.07k stars 176 forks source link

Folder with alternate name is not processed when it does not directly contain files #372

Closed aacebedo closed 2 years ago

aacebedo commented 3 years ago

Describe the bug

If a folder named with an alternate name contains only folders it is not processed

To reproduce

yadm init
mkdir -p ~/.config/foo##default/bar
touch  ~/.config/foo##default/bar/baz
yadm add ~/.config/foo##default
yadm commit
yadm alt

Expected behavior

Links shall be created, nothing happens

Environment

TheLocehiliosan commented 2 years ago

This currently works as intended. That is, alt directories are symlinked if there is at least one yadm managed file within the directory. Your example does not work because no yadm managed file exists directly within foo##default. If you were to also include the commands...

touch ~/.config/foo##default/.empty
yadm add ~/.config/foo##default/.empty

...you would find the foo symlink created.

Changing yadm to search up the directory structure for possible alternate directories could be challenging and degrade performance. Regardless, doing so would be a feature enhancement, not a bug. I do think the documentation concerning this could be clearer.

In the meantime, you can achieve your desired linking by adding an empty tracked file directly to the directory you want to have linked.

masukomi commented 2 years ago

to build on that, git doesn't track directories, it tracks files and the info related to their path. You can't add a directory to git if there aren't files somewhere inside of it or the directories beneath it.

github-actions[bot] commented 2 years ago

This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 2 years ago

This issue was closed because it has been labeled as stale for 7 days with no activity.