From b623fb6de661c7461693d9be7f46078e9e0f1f14 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 3 Jan 2006 11:39:31 +0000 Subject: [PATCH] always ignore CVS and cfgsave --- Stow.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Stow.pm b/Stow.pm index 0dac4dd..61c8fe0 100755 --- a/Stow.pm +++ b/Stow.pm @@ -541,16 +541,20 @@ sub parent { sub get_ignore_re_from_file { my ($file) = @_; # Bootstrap issue - first time we stow, we will be stowing - # .cvsignore so it won't exist in ~ yet. At that time, use - # a sensible default instead. - open(REGEXPS, $file) or return qr!\.cfgsave\.|^(CVS)$!; - my @regexps; - while () { - chomp; - push @regexps, glob_to_re($_); + # .cvsignore so it might not exist in ~ yet, or if it does, it could + # be an old version missing the entries we need. So we make sure + # they are there. + my %globs; + if (open(GLOBS, $file)) { + while () { + chomp; + $globs{$_}++; + } + close(GLOBS); } - close(REGEXPS); - my $re = join '|', @regexps; + $globs{$_}++ foreach '*.cfgsave.*', 'CVS'; + + my $re = join '|', map glob_to_re($_), keys %globs; warn "#% ignore regexp is $re\n" if $opts{verbose}; return qr/$re/; }