- improve debugging - ignore cfgsave

This commit is contained in:
adam 2005-12-21 11:53:58 +00:00 committed by Adam Spiers
parent c5888a964f
commit 253ae16fe6

11
stow.in
View file

@ -231,7 +231,8 @@ sub Unstow {
return (0, '') if (-e &JoinPaths($Target, $targetdir, '.stow')); return (0, '') if (-e &JoinPaths($Target, $targetdir, '.stow'));
warn sprintf("Unstowing in %s\n", &JoinPaths($Target, $targetdir)) warn sprintf("Unstowing in %s\n", &JoinPaths($Target, $targetdir))
if ($Verbose > 1); 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"; 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); @contents = readdir(DIR);
@ -351,7 +352,8 @@ sub StowContents {
# hack to ignore stuff in ~/.cvsignore # hack to ignore stuff in ~/.cvsignore
next if $content eq '.' or $content eq '..'; next if $content eq '.' or $content eq '..';
if ($content =~ $ignore_re) { 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; if $Verbose > 2;
next; next;
} }
@ -563,17 +565,18 @@ sub version {
sub get_ignore_re_from_file { sub get_ignore_re_from_file {
my ($file) = @_; my ($file) = @_;
my @regexps;
# Bootstrap issue - first time we stow, we will be stowing # Bootstrap issue - first time we stow, we will be stowing
# .cvsignore so it won't exist in ~ yet. At that time, use # .cvsignore so it won't exist in ~ yet. At that time, use
# a sensible default instead. # a sensible default instead.
open(REGEXPS, $file) or return qr!^(CVS)$!; open(REGEXPS, $file) or return qr!\.cfgsave\.|^(CVS)$!;
my @regexps;
while (<REGEXPS>) { while (<REGEXPS>) {
chomp; chomp;
push @regexps, glob_to_re($_); push @regexps, glob_to_re($_);
} }
close(REGEXPS); close(REGEXPS);
my $re = join '|', @regexps; my $re = join '|', @regexps;
debug("#% ignore regexp is $re\n");
return qr/$re/; return qr/$re/;
} }