In perl.git, the branch vincent/faster-PathTools has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fcb7cbea88021c621a9aae6dd7fc3789d2be4e0f?hp=325335d0b4100c7668b25bfcdcdb32f1973a1291>

- Log -----------------------------------------------------------------
commit fcb7cbea88021c621a9aae6dd7fc3789d2be4e0f
Author: Vincent Pit <[email protected]>
Date:   Thu Apr 26 18:53:21 2012 +0200

    Merge two substitutions in one in File::Spec::Unix::canonpath()
    
    Now that the comment was corrected, it is obvious that the two
    substitutions can be merged.
    
    I suspect that that '$' is wrong and should be a '\z' but, knowing
    File::Spec, I'm pretty sure someone somewhere relies on this.

M       dist/Cwd/lib/File/Spec/Unix.pm

commit 546988532da101abdb14730a768271852fa9cefe
Author: Vincent Pit <[email protected]>
Date:   Thu Apr 26 18:47:58 2012 +0200

    Fix a comment in File::Spec::Unix::canonpath()
    
    The code was not doing what the comment was describing, and I believe the
    code is right here ('/../xx' should be turned into '/xx' and not into 'xx').

M       dist/Cwd/lib/File/Spec/Unix.pm
-----------------------------------------------------------------------

Summary of changes:
 dist/Cwd/lib/File/Spec/Unix.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/Cwd/lib/File/Spec/Unix.pm b/dist/Cwd/lib/File/Spec/Unix.pm
index fd29aba..1a53eb0 100644
--- a/dist/Cwd/lib/File/Spec/Unix.pm
+++ b/dist/Cwd/lib/File/Spec/Unix.pm
@@ -70,8 +70,8 @@ sub canonpath {
     $path =~ s|/{2,}|/|g;                            # xx////xx  -> xx/xx
     $path =~ s{(?:/\.)+(?:/|\z)}{/}g;                # xx/././xx -> xx/xx
     $path =~ s|^(?:\./)+||s unless $path eq "./";    # ./xx      -> xx
-    $path =~ s|^/(?:\.\./)+|/|;                      # /../../xx -> xx
-    $path =~ s|^/\.\.$|/|;                         # /..       -> /
+    $path =~ s{^(?:/\.\.)+(?:/|$)}{/};               # /../../xx -> /xx
+                                                     # /..       -> /
     $path =~ s|/\z|| unless $path eq "/";          # xx/       -> xx
 
     _DOUBLE_SLASHES_SPECIAL ? ($node . $path) : $path;

--
Perl5 Master Repository

Reply via email to