Remove quote stripping code.
I'm guessing it was added due to a misunderstanding of how shell quoting works. When you invoke stow --ignore=".#.*" ... the shell strips out the quotes before the Perl process ever sees them. I can't imagine any sensible scenario in which you would need to invoke stow --ignore='"foo"' but if the user has a filename containing quotes at the beginning and end, they can now choose to ignore it (prior to this patch, they couldn't).
This commit is contained in:
parent
3d414dc071
commit
bcac91d68a
2 changed files with 6 additions and 38 deletions
27
bin/stow.in
27
bin/stow.in
|
@ -465,20 +465,19 @@ sub process_options {
|
|||
# clean and pre-compile any regex's at parse time
|
||||
'ignore=s' =>
|
||||
sub {
|
||||
# FIXME: do we really need strip_quotes here?
|
||||
my $regex = strip_quotes($_[1]);
|
||||
my $regex = $_[1];
|
||||
push @{$options{ignore}}, qr($regex\z);
|
||||
},
|
||||
|
||||
'override=s' =>
|
||||
sub {
|
||||
my $regex = strip_quotes($_[1]);
|
||||
my $regex = $_[1];
|
||||
push @{$options{override}}, qr(\A$regex);
|
||||
},
|
||||
|
||||
'defer=s' =>
|
||||
sub {
|
||||
my $regex = strip_quotes($_[1]);
|
||||
my $regex = $_[1];
|
||||
push @{$options{defer}}, qr(\A$regex);
|
||||
},
|
||||
|
||||
|
@ -629,26 +628,6 @@ sub version {
|
|||
exit 0;
|
||||
}
|
||||
|
||||
#===== METHOD ================================================================
|
||||
# Name : strip_quotes
|
||||
# Purpose : remove matching outer quotes from the given string
|
||||
# Parameters: none
|
||||
# Returns : n/a
|
||||
# Throws : no exceptions
|
||||
# Comments : none
|
||||
#=============================================================================
|
||||
sub strip_quotes {
|
||||
my ($string) = @_;
|
||||
|
||||
if ($string =~ m{\A\s*'(.*)'\s*\z}) {
|
||||
return $1;
|
||||
}
|
||||
elsif ($string =~ m{\A\s*"(.*)"\s*\z}) {
|
||||
return $1
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
# Local variables:
|
||||
# mode: perl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue