Summary
--ignore=<regex> lines that I put in my .stowrc does not work. When running Stow, it says "Loading defaults from .stowrc", yet it has no effect. But passing the --ignore=<regex> lines to the command directly works.
Problem
Assume this directory:
user@user-machine:~/test-stow/stow$ tree -a
.
├── a
│ └── car
└── .stowrc
1 directory, 2 files
Contents of ./.stowrc:
--ignore='car'
So my expectation is that running the command stow --verbose=3 a/ while in that directory is equivalent to running stow --ignore='car' --verbose=3 a/ if the ./.stowrc file wasn't there.
Now I run:
user@user-machine:~/test-stow/stow$ stow --verbose=3 a
Loading defaults from .stowrc
stow dir is /home/user/test-stow/stow
stow dir path relative to target /home/user/test-stow is stow
cwd now /home/user/test-stow
cwd restored to /home/user/test-stow/stow
cwd now /home/user/test-stow
Planning stow of package a...
Stowing contents of stow/a (cwd=~/test-stow)
Stowing stow/a/car
LINK: car => stow/a/car
Planning stow of package a... done
cwd restored to /home/user/test-stow/stow
Processing tasks...
cwd now /home/user/test-stow
cwd restored to /home/user/test-stow/stow
Processing tasks... done
Note that this does create the symlink to ./car, despite the ignore line in ./.stowrc.
Now I undo the operation by running stow -D --verbose=3 a/:
user@user-machine:~/test-stow/stow$ stow -D --verbose=3 a/
stow dir is /home/user/test-stow/stow
stow dir path relative to target /home/user/test-stow is stow
cwd now /home/user/test-stow
Planning unstow of package a...
Unstowing from . (cwd=~/test-stow, stow dir=stow)
Unstowing stow/a/car
car did not exist to be unstowed
Planning unstow of package a... done
cwd restored to /home/user/test-stow/stow
cwd now /home/user/test-stow
cwd restored to /home/user/test-stow/stow
Processing tasks...
If I delete everything in ./.stowrc and run stow --verbose=3 --ignore='car' a/, I get a different result:
user@user-machine:~/test-stow/stow$ stow --verbose=3 --ignore='car' a/
stow dir is /home/user/test-stow/stow
stow dir path relative to target /home/user/test-stow is stow
cwd now /home/user/test-stow
cwd restored to /home/user/test-stow/stow
cwd now /home/user/test-stow
Planning stow of package a...
Stowing contents of stow/a (cwd=~/test-stow)
Planning stow of package a... done
cwd restored to /home/user/test-stow/stow
Processing tasks...
Now a symlink to ./car was not created, as expected and desired.
What about $HOME/.stowrc?
Placing the .stowrc file in the home directory instead of $HOME/test-stow/stow has the same effect; a symlink to the file car still gets made.
Ignore lists
Having a file $HOME/test-stow/stow/.stow-local-ignore with the content "car" instead of the .stowrc file doesn't work, either. The symlink to the file named car still gets created.
GNU Stow version: 2.2.0
Perl version: perl 5, version 18
Update
Here is my reply to Adam Spiers' answer.