- 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'));
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 (<REGEXPS>) {
chomp;
push @regexps, glob_to_re($_);
}
close(REGEXPS);
my $re = join '|', @regexps;
debug("#% ignore regexp is $re\n");
return qr/$re/;
}