stow icon indicating copy to clipboard operation
stow copied to clipboard

~/.stow-global-ignore doesn't work

Open eggbean opened this issue 2 years ago • 9 comments

This page mentions that it is possible to make a global ~/.stow-global-ignore, but it does not seem to work when I make one. I copied this from one of my (working) .stow-local-ignore files which I then deleted, but the ignores do not apply:

\.git
\.gitignore
.*\.(bak|tmp|notes)

The ~/.stow-global-ignore file is actually a stow symlink itself, but it's the same when making it into an actual file.

I'm using stow (GNU Stow) version 2.3.1.

eggbean avatar Jul 17 '21 15:07 eggbean

I still cannot figure out what is going on. There seems to be two issues:

  • From looking at the verbose log, when there's a .stow-global-ignore, ~/.stow-global-ignore seems to be ignored.

  • When I have .*\.env in both files, it still does not get ignored.

...
  Using ignore file: ../../.dotfiles/.bin/scripts/.stow-local-ignore
    Using memoized regexps from ../../.dotfiles/.bin/scripts/.stow-local-ignore
    Ignore list regexp for paths:    /(?^:(^|/)(^/\.stow\-local\-ignore$)(/|$))/
    Ignore list regexp for segments: /(?^:^(src|.*\.env|dir_colors)$)/
  Not ignoring dynu.sh
Stowing ../../.dotfiles/.bin / scripts / dynu.sh
  => ../../.dotfiles/.bin/scripts/dynu.sh
  is_a_link(dynu.sh)
  link_task_action(dynu.sh): link task exists with action remove
  is_a_link(dynu.sh): returning 0 (remove action found)
  is_a_node(dynu.sh)
  link_task_action(dynu.sh): link task exists with action remove
  dir_task_action(dynu.sh): no task
LINK: dynu.sh => ../../.dotfiles/.bin/scripts/dynu.sh (reverts previous action)

eggbean avatar Oct 13 '21 13:10 eggbean

Can anybody else confirm that ~/.stow-global-ignore doesn't work? Does anybody know if it worked in any previous versions? I could consider downgrading to an earlier version if it doesn't have the issues of the current version and if that version doesn't lack any features that I use.

eggbean avatar Feb 01 '22 00:02 eggbean

I confirm the problem.

The .stow-local-ignore rules override the .stow-global-ignore rules. The ideal would be a mix of the two files.

version: from source (4ef5eca)

gutierri avatar Sep 19 '22 01:09 gutierri

Thanks for confirming this. I use this program heavily, so I'm really looking forward to someone fixing the little bugs present in the current version.

eggbean avatar Sep 19 '22 04:09 eggbean

I found out where the bug is. I need some time to figure it out. Thinking that the files join the two rules at the end ---- On Mon, 19 Sep 2022 01:17:10 -0300 @.*** wrote ---- Thanks for confirming this. I use this program heavily, so I'm really looking forward to someone fixing the little bugs present in the current version.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

gutierri avatar Sep 27 '22 14:09 gutierri

Me trying to be helpful:

https://metacpan.org/pod/File::Cmp

?

eggbean avatar Sep 27 '22 17:09 eggbean

The root of the problem is apparently here (line 1290). It returns the first rule it finds. the ideal would be to end the file checking loop while concatenating what exists.

What prevents this from being quickly fixed by me is time and experience with perl. I'm just a perl hobbyist. And I happen to use stow extensively as well. I hope to fix it soon or maybe some collaborator will help with this too.

https://github.com/aspiers/stow/blob/4ef5eca4a9d107b24e712bb4c2c91f47e7e0fb85/lib/Stow.pm.in#L1273-L1299

gutierri avatar Sep 28 '22 05:09 gutierri

Ask on StackOverflow?

eggbean avatar Sep 28 '22 05:09 eggbean

It's not about asking specific questions about perl, but understanding the behavior of the functions used by stow. This code snippet is responsible for validating the rules of the ignore files, but it needs to be understood and understood how the other dependent functions use it and adjusted to include more than 1 value when there is more than 1 file.

gutierri avatar Sep 28 '22 22:09 gutierri

@aspiers Could you classify this issue as a bug (add label bug)?

gutierri avatar Apr 08 '24 19:04 gutierri

@gutierri Do you mean this:

From looking at the verbose log, when there's a .stow-global-ignore, ~/.stow-global-ignore seems to be ignored.

I guess that was a typo and meant to say

when there's a .stow-local-ignore, ~/.stow-global-ignore seems to be ignored.

That's not a bug - it's working as designed and documented, because creating a local ignore file is the currently only way to disable patterns in the global one.

That said, I certainly agree that it would be useful to be able to combine both global and local. For that ideally we would have something similar to .gitignore rules, where you can use ! to negate a previous rule. (BTW coincidentally many years ago, I implemented the git check-ignore subcommand!)

aspiers avatar Apr 08 '24 20:04 aspiers

Can anybody else confirm that ~/.stow-global-ignore doesn't work?

I can confirm that it definitely does work :stuck_out_tongue_winking_eye: I've been relying on that for years myself. But as per my previous comment, it does get overridden by a .stow-local-ignore.

aspiers avatar Apr 08 '24 20:04 aspiers

When I have .*\.env in both files, it still does not get ignored.

This does sound like a bug if true, but if that's reproducible please file a separate issue for it.

aspiers avatar Apr 08 '24 20:04 aspiers