Fix unstowing with --compat --dotfiles
Unstowing with `--dotfiles` didn't work with `--compat`, because when traversing the target tree rather than the package tree, there was no mechanism for mapping a `.foo` file or directory back to its original `dot-foo` and determine whether it should be unstowed. So add a reverse `unadjust_dotfile()` mapping mechanism to support this.
This commit is contained in:
parent
723ddcf3a4
commit
93fc195ddb
3 changed files with 67 additions and 13 deletions
|
@ -38,7 +38,8 @@ use POSIX qw(getcwd);
|
|||
use base qw(Exporter);
|
||||
our @EXPORT_OK = qw(
|
||||
error debug set_debug_level set_test_mode
|
||||
join_paths parent canon_path restore_cwd adjust_dotfile
|
||||
join_paths parent canon_path restore_cwd
|
||||
adjust_dotfile unadjust_dotfile
|
||||
);
|
||||
|
||||
our $ProgramName = 'stow';
|
||||
|
@ -244,6 +245,14 @@ sub adjust_dotfile {
|
|||
return $adjusted;
|
||||
}
|
||||
|
||||
# Needed when unstowing with --compat and --dotfiles
|
||||
sub unadjust_dotfile {
|
||||
my ($target_node) = @_;
|
||||
return $target_node if $target_node =~ /^\.\.?$/;
|
||||
(my $adjusted = $target_node) =~ s/^\./dot-/;
|
||||
return $adjusted;
|
||||
}
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue