Search code examples
linuxdotfilesstow

Why doesn't GNU Stow ignore single files in main directory?


I've added a README to my dotfile folder and since I'm managing each package with stow I'd like to ignore that. From documentation I've read that by default stow uses a preset list which includes README files. Now, this doesn't seem to work. I've also tried adding a .stow-global-ignore but same error. Even forcing with stow -nv --ignore='README.md' * leads to nothing.

$ tree
.
├── i3
├── i3status
├── nvim
├── README.md
├── rofi
├── stow
├── urxvt
└── zsh

$ stow -nv *
LINK: .config/i3/config => ../../.dotfiles/i3/.config/i3/config
LINK: .config/i3status/config => ../../.dotfiles/i3status/.config/i3status/config
LINK: .config/nvim/init.vim => ../../.dotfiles/nvim/.config/nvim/init.vim
stow: ERROR: The stow directory .dotfiles does not contain package README.md

My guess is that ignore list applies only to packages (hence dirs) inside the stow directory? Any workaround for this?


Solution

  • I just came across the same issue, I found adding the trailing slash to the wildcard */ meant the glob would only look for directories, ignoring all files at the 'root' (dotfiles folder in my case) of the stow. This ignores my files like the readme.md and license.txt which is what I want.

    My stow command becomes (run from within my dotfiles repo directory)

    stow -t ~ */
    

    I don't think it's ever valid for stow to try and stow files at the root, I think they need to be always nested in a folder, so potentially this should be the default, but I'm a little vague there. This solution would not work if there was ever a use case for stowing a file from the stow root.

    Credit to this post which got me thinking.