aspiers / stow

GNU Stow - mirror of savannah git repository occasionally with more bleeding-edge branches
http://www.gnu.org/s/stow/
GNU General Public License v3.0
650 stars 41 forks source link

.stow-local-ignore: stow does not ignore file when parent directory does not exist #91

Open Kraymer opened 3 years ago

Kraymer commented 3 years ago

The package exhibiting the problem : https://github.com/Kraymer/F-dotfiles/tree/master/git the file /.config/git/credentials.example should be ignored because declared in .stow-local-ignore, it is not always the case

stowing if ~/.config/git̀ exists beforehand => .stow-local-ignore works as expected

$ mkdir ~/.config/git
$ stow -v5 -D git   
[...]
Stowing contents of dev/F-dotfiles/git/.config/git (cwd=/home/flap)
  => ../../dev/F-dotfiles/git/.config/git
  is_a_node(.config/git)
  link_task_action(.config/git): no task
  dir_task_action(.config/git): no task
    parent_link_scheduled_for_removal(.config/git): prefix .config
    parent_link_scheduled_for_removal(.config/git): prefix .config/git
    parent_link_scheduled_for_removal(.config/git): returning false
  is_a_node(.config/git): really exists
  Using ignore file: dev/F-dotfiles/git/.stow-local-ignore
    Using memoized regexps from dev/F-dotfiles/git/.stow-local-ignore
    Ignore list regexp for paths:    /(?^:(^|/)(.config/git/credentials.example|\.config/git/credentials.example|/.config/git/credentials.example|^/\.stow\-local\-ignore$)(/|$))/
    Ignore list regexp for segments: /(?^:^(\.example)$)/
  Ignoring path /.config/git/credentials.example

stowing if ~/.config/git̀ not exists beforehand => ~/.config/git̀ is symlinked including ignored file

$ rm -rf ~/.config/git
$ stow -v5 -D git   
[...]
Stowing contents of dev/F-dotfiles/git (cwd=/home/flap)
  => dev/F-dotfiles/git
  is_a_node(.)
  link_task_action(.): no task
  dir_task_action(.): no task
    parent_link_scheduled_for_removal(.): prefix 
    parent_link_scheduled_for_removal(.): returning false
  is_a_node(.): really exists
  Using ignore file: dev/F-dotfiles/git/.stow-local-ignore
    Using memoized regexps from dev/F-dotfiles/git/.stow-local-ignore
    Ignore list regexp for paths:    /(?^:(^|/)(^/\.stow\-local\-ignore$|.config/git/credentials.example)(/|$))/
    Ignore list regexp for segments: none
  Not ignoring .config