git-svn: cleanup sprintf usage for uppercasing hex
authorEric Wong <normalperson@yhbt.net>
Thu, 24 Jan 2013 00:23:44 +0000 (00:23 +0000)
committerEric Wong <normalperson@yhbt.net>
Thu, 24 Jan 2013 10:21:23 +0000 (10:21 +0000)
We do not need to call uc() separately for sprintf("%x")
as sprintf("%X") is available.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
perl/Git/SVN.pm
perl/Git/SVN/Editor.pm

index 59215fa86e2c2902ec97b12bea70736f9c7c02c6..490e3303804e834497fa1bd3f62500a7b07a31f1 100644 (file)
@@ -490,7 +490,7 @@ sub refname {
        #
        # Additionally, % must be escaped because it is used for escaping
        # and we want our escaped refname to be reversible
-       $refname =~ s{([ \%~\^:\?\*\[\t])}{uc sprintf('%%%02x',ord($1))}eg;
+       $refname =~ s{([ \%~\^:\?\*\[\t])}{sprintf('%%%02X',ord($1))}eg;
 
        # no slash-separated component can begin with a dot .
        # /.* becomes /%2E*
@@ -2377,7 +2377,7 @@ sub map_path {
 
 sub uri_encode {
        my ($f) = @_;
-       $f =~ s#([^a-zA-Z0-9\*!\:_\./\-])#uc sprintf("%%%02x",ord($1))#eg;
+       $f =~ s#([^a-zA-Z0-9\*!\:_\./\-])#sprintf("%%%02X",ord($1))#eg;
        $f
 }
 
index 3db152155c62fb43b6243c10ce25cc193895afe3..fa0d3c6cddfa7a36745c576ba69e484675238593 100644 (file)
@@ -146,7 +146,7 @@ sub url_path {
        my ($self, $path) = @_;
        if ($self->{url} =~ m#^https?://#) {
                # characters are taken from subversion/libsvn_subr/path.c
-               $path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#uc sprintf("%%%02x",ord($1))#eg;
+               $path =~ s#([^~a-zA-Z0-9_./!$&'()*+,-])#sprintf("%%%02X",ord($1))#eg;
        }
        $self->{url} . '/' . $self->repo_path($path);
 }