Skip to content

Commit

Permalink
git-svn: cleanup sprintf usage for uppercasing hex
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Wong committed Jan 24, 2013
1 parent ec3ae6e commit 1b67bef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions perl/Git/SVN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion perl/Git/SVN/Editor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1b67bef

Please sign in to comment.