andsens / homeshick

git dotfiles synchronizer written in bash
MIT License
2.1k stars 147 forks source link

Automatically symlink submodules of castle as a single symlink to toplevel directory #192

Closed cirosantilli closed 5 years ago

cirosantilli commented 5 years ago

For submodules, one expects to not have any untracked changes, so it would be cleaner to just symlink to the toplevel directory of the submodule.

This way I can just cd and git pull when I want to update without any further actions.

Currently, if I put a sumodule under home/ it just symlinks all files in the submodule.

Tested at: 1e3e1eafe65e0d0d21230a6325e13fc9af36fa1d

andsens commented 5 years ago

https://github.com/andsens/homeshick/wiki/Symlinking#shallow-symlinking :-)

cirosantilli commented 5 years ago

:+1: :+1: :+1: :+1:

Worth mentioning: I had to git commit in my dotfiles for it to take effect. Then it all works beautifully.

benjaminoakes commented 4 years ago

Is there a way to have shallow symlinking without changing the structure of the repository? I'm currently using homesick and sharing a couple of homesick castles with others, so modifying the structure for use with homeshick is undesirable. It'd be nice to have a flag on homeshick link that acts more like homesick link. I'd really like to be able to avoid the Ruby/RubyGems dependency by using homeshick, but right now the structure change as described in the wiki is pretty much a blocker.

I think everything works without shallow symlinking, but the massive number of files I have in vim plugins, etc makes it take forever to link.

andsens commented 4 years ago

@benjaminoakes oh man. That's a valid concern and I understand the issue. I myself maintain something for my workplace where changes like that are pretty much a no-go. A small saving grace here is that your scenario would end up in the rm? && link field of the directory->not directory row/column, meaning people would be prompted about the rm -rf && ln -s. So if they have any local changes, they would hopefully know to stash them somewhere.
Alternatively you could maybe get away with only creating symlinks for specific subfolders where you know there are a lot of small files and users are unlikely to have any customizations.
The principle of homeshick is very KISS and zeroconf like, which I enforce by only relying on the directory structure. Beyond skipping prompts I wouldn't feel comfortable with adding any behavior-changing flags. You'd have to remember them everytime you invoked e.g. link on a computer where you haven't pulled the changes yet.