Skip to content
Browse files

optimize local-fetch by moving things out of the loop

  • Loading branch information...
1 parent 30357d3 commit 43822c6c64fea1730e02ff7ff787883a81a05fad @FROGGS FROGGS committed
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/Panda/Fetcher.pm
View
7 lib/Panda/Fetcher.pm
@@ -26,12 +26,13 @@ sub git-fetch($from, $to) {
sub local-fetch($from, $to) {
# We need to eagerify this, as we'll sometimes
# copy files to a subdirectory of $from
+ my $cleanup = $from.IO.path.cleanup;
+ my $cleanup_chars = $cleanup.chars;
for eager find(dir => $from).list {
my $d = IO::Spec.catpath($_.volume, $_.directory, '');
# We need to cleanup the path, because the returned elems are too.
- my $cleanup = $from.IO.path.cleanup;
- if $d.match(/^$cleanup/) {
- $d = $d.substr($cleanup.chars)
+ if ($d.Str.index(~$cleanup) // -1) == 0 {
+ $d = $d.substr($cleanup_chars)
}
next if $d ~~ /^ '/'? '.git'/; # skip VCS files

0 comments on commit 43822c6

Please sign in to comment.
Something went wrong with that request. Please try again.