anishathalye / dotbot

A tool that bootstraps your dotfiles ⚡️
MIT License
7.04k stars 291 forks source link

```exclude``` seems to be ignored in linking #266

Closed arkAD93 closed 3 years ago

arkAD93 commented 3 years ago

Hello everyone, I have a zsh config folder in my .dotfiles, which looks like this:

zsh/alias.zsh
zsh/bindings.zsh
zsh/custom_completions/_docker-compose
zsh/custom_completions/_gh
zsh/env.zsh
zsh/functions.zsh
zsh/install_zsh.sh
zsh/options.zsh
zsh/plugins.txt
zsh/plugins.zsh
zsh/zshenv
zsh/zshrc

I also have my install.conf.yaml to try things out, which looks as follows:

- link:
    ~/.zshenv:
      path: zsh/zshenv
    ~/.config/zsh/:
      glob: true
      path: zsh/*
      exclude:
        - zsh/zshenv
        - zsh/zshrc

However, by the look of things my exlude is completely ignored:

Link exists ~/.zshenv -> /Users/USER/.dotfiles/zsh/zshenv
Globs from 'zsh/*': ['zsh/options.zsh', 'zsh/plugins.txt', 'zsh/alias.zsh', 'zsh/zshrc', 'zsh/zshenv', 'zsh/bindings.zsh', 'zsh/install_zsh.sh', 'zsh/functions.zsh', 'zsh/custom_completions', 'zsh/plugins.zsh', 'zsh/env.zsh']
Link exists ~/.config/zsh/options.zsh -> /Users/USER/.dotfiles/zsh/options.zsh
Link exists ~/.config/zsh/plugins.txt -> /Users/USER/.dotfiles/zsh/plugins.txt
Link exists ~/.config/zsh/alias.zsh -> /Users/USER/.dotfiles/zsh/alias.zsh
Creating link ~/.config/zsh/zshrc -> /Users/USER/.dotfiles/zsh/zshrc
Creating link ~/.config/zsh/zshenv -> /Users/USER/.dotfiles/zsh/zshenv
Link exists ~/.config/zsh/bindings.zsh -> /Users/USER/.dotfiles/zsh/bindings.zsh
Link exists ~/.config/zsh/install_zsh.sh -> /Users/USER/.dotfiles/zsh/install_zsh.sh
Link exists ~/.config/zsh/functions.zsh -> /Users/USER/.dotfiles/zsh/functions.zsh
Link exists ~/.config/zsh/custom_completions -> /Users/USER/.dotfiles/zsh/custom_completions
Link exists ~/.config/zsh/plugins.zsh -> /Users/USER/.dotfiles/zsh/plugins.zsh
Link exists ~/.config/zsh/env.zsh -> /Users/USER/.dotfiles/zsh/env.zsh

I tried all sorts of different approaches with exclude statement, however it keeps linking files, which I am trying to exclude.

Am I missing something here?

etkeys commented 3 years ago

Hi! What version of dotbot are you using? Can you run again with --verbose and provide the resulting output?

bitsandscraps commented 3 years ago

Having the same problem here. I'm using dotbot v1.18.0~2

anishathalye commented 3 years ago

@bitsandscraps could you give the git commit hash you're using (e.g. with a git submodule status dotbot)? Exclude parameters were added pretty recently, in 22ed23c.

I tried the config from @arkAD93's post, and it works for me with the latest Dotbot.

Config:

- defaults:
    link:
      create: true
      relink: true
- link:
    ~/.zshenv:
      path: zsh/zshenv
    ~/.config/zsh/:
      glob: true
      path: zsh/*
      exclude:
        - zsh/zshenv
        - zsh/zshrc

Output:

Globs from 'zsh/*': ['zsh/custom_completions', 'zsh/options.zsh', 'zsh/plugins.zsh', 'zsh/env.zsh', 'zsh/functions.zsh', 'zsh/install_zsh.sh', 'zsh/bindings.zsh', 'zsh/alias.zsh', 'zsh/plugins.txt']
Creating directory /Users/anish/.config/zsh
Creating link ~/.config/zsh/custom_completions -> /private/tmp/test/zsh/custom_completions
Creating link ~/.config/zsh/options.zsh -> /private/tmp/test/zsh/options.zsh
Creating link ~/.config/zsh/plugins.zsh -> /private/tmp/test/zsh/plugins.zsh
Creating link ~/.config/zsh/env.zsh -> /private/tmp/test/zsh/env.zsh
Creating link ~/.config/zsh/functions.zsh -> /private/tmp/test/zsh/functions.zsh
Creating link ~/.config/zsh/install_zsh.sh -> /private/tmp/test/zsh/install_zsh.sh
Creating link ~/.config/zsh/bindings.zsh -> /private/tmp/test/zsh/bindings.zsh
Creating link ~/.config/zsh/alias.zsh -> /private/tmp/test/zsh/alias.zsh
Creating link ~/.config/zsh/plugins.txt -> /private/tmp/test/zsh/plugins.txt
Creating link ~/.zshenv -> /private/tmp/test/zsh/zshenv
All links have been set up

==> All tasks executed successfully
arkAD93 commented 3 years ago

That's strange, git submodule status dotbot gave me:

5294594f5aa9c3affd0d656ba6843c1c0b0bce60 dotbot (v1.17.1-2-g5294594)

Which would mean I am not at the newest version - but I followed

cd ~/.dotfiles # replace with the path to your dotfiles
git init # initialize repository if needed
git submodule add https://github.com/anishathalye/dotbot
git config -f .gitmodules submodule.dotbot.ignore dirty # ignore dirty commits in the submodule
anishathalye commented 3 years ago

When did you set up Dotbot? That may have been the latest version when you set it up. You can upgrade it with git submodule update --remote dotbot (remember to git commit your changes afterwards, or the ./install will revert it).

arkAD93 commented 3 years ago

When did you set up Dotbot? That may have been the latest version when you set it up. You can upgrade it with git submodule update --remote dotbot (remember to git commit your changes afterwards, or the ./install will revert it). Cannot say for sure, about 1-2h before opening the issue.

Looks like git submodule update --remote dotbot did the trick. I have no idea how I ended up with older version. Thanks for helping out.