From 253ae16fe60420024e036480335b268e0b0893ed Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 21 Dec 2005 11:53:58 +0000 Subject: [PATCH] - improve debugging - ignore cfgsave --- stow.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/stow.in b/stow.in index 1f41f4a..54c8922 100755 --- a/stow.in +++ b/stow.in @@ -231,7 +231,8 @@ sub Unstow { return (0, '') if (-e &JoinPaths($Target, $targetdir, '.stow')); warn sprintf("Unstowing in %s\n", &JoinPaths($Target, $targetdir)) if ($Verbose > 1); - if (!opendir(DIR, &JoinPaths($Target, $targetdir))) { + my $dir = &JoinPaths($Target, $targetdir); + if (!opendir(DIR, $dir)) { warn "Warning: $ProgramName: Cannot read directory \"$dir\" ($!). Stow might leave some links. If you think, it does. Rerun Stow with appropriate rights.\n"; } @contents = readdir(DIR); @@ -351,7 +352,8 @@ sub StowContents { # hack to ignore stuff in ~/.cvsignore next if $content eq '.' or $content eq '..'; if ($content =~ $ignore_re) { - warn "Ignoring $joined/$content via $ignore_file\n" + # We assume -r implies the open succeeded - lazy + warn "Ignoring $joined/$content", (-r $ignore_file ? " via $ignore_file" : ""), "\n" if $Verbose > 2; next; } @@ -563,17 +565,18 @@ sub version { sub get_ignore_re_from_file { my ($file) = @_; - my @regexps; # 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!^(CVS)$!; + open(REGEXPS, $file) or return qr!\.cfgsave\.|^(CVS)$!; + my @regexps; while () { chomp; push @regexps, glob_to_re($_); } close(REGEXPS); my $re = join '|', @regexps; + debug("#% ignore regexp is $re\n"); return qr/$re/; }