From: Eric Wong Date: Sat, 26 Dec 2015 04:35:22 +0000 (+0000) Subject: hval: rename new_bin => utf8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d797c6c10d19b59c725fe63d782d5e94f1d80d48;p=thirdparty%2Fpublic-inbox.git hval: rename new_bin => utf8 This shorter name is more descriptive of what the method actually does. --- diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index 2974c6838..c38ef7d8e 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -21,7 +21,7 @@ use constant PRE => ""; # legacy my $enc_utf8 = find_encoding('UTF-8'); my $enc_ascii = find_encoding('us-ascii'); -sub new_bin { +sub utf8 { my ($class, $raw, $href) = @_; $raw = $enc_utf8->decode($raw); diff --git a/lib/PublicInbox/RepoBrowseGitCommit.pm b/lib/PublicInbox/RepoBrowseGitCommit.pm index c70b1d1b4..a5c98c57d 100644 --- a/lib/PublicInbox/RepoBrowseGitCommit.pm +++ b/lib/PublicInbox/RepoBrowseGitCommit.pm @@ -45,7 +45,7 @@ sub git_commit_stream { $x .= ' -- '; $x .= join('/', map { push @t, $_; - my $e = PublicInbox::Hval->new_bin($_, join('/', @t)); + my $e = PublicInbox::Hval->utf8($_, join('/', @t)); $ep = $e->as_path; my $eh = $e->as_html; "$eh"; @@ -177,7 +177,7 @@ sub git_show_diffstat { } my $num = sprintf('% 6s/%-6s', $del, $add); if (length $l) { - $l = PublicInbox::Hval->new_bin($l); + $l = PublicInbox::Hval->utf8($l); my $lp = $l->as_path; my $lh = $l->as_html; $l = "$lh"; @@ -217,8 +217,8 @@ sub git_diff_ab_hdr { $fb = git_unquote($fb); $fa =~ s!\Aa/!!; $fb =~ s!\Ab/!!; - $fa = $diff->{fa} = PublicInbox::Hval->new_bin($fa); - $fb = $diff->{fb} = PublicInbox::Hval->new_bin($fb); + $fa = $diff->{fa} = PublicInbox::Hval->utf8($fa); + $fb = $diff->{fb} = PublicInbox::Hval->utf8($fb); $diff->{path_a} = $fa->as_path; $diff->{path_b} = $fb->as_path; @@ -256,7 +256,7 @@ sub git_diff_ab_hunk { sub git_diff_cc_hdr { my ($diff, $path) = @_; my $html_path = utf8_html($path); - my $cc = $diff->{cc} = PublicInbox::Hval->new_bin(git_unquote($path)); + my $cc = $diff->{cc} = PublicInbox::Hval->utf8(git_unquote($path)); $diff->{path_cc} = $cc->as_path; "diff --cc $html_path"; } @@ -328,7 +328,7 @@ sub git_diffstat_rename { $base = utf8_html(join('/', @base)) if @base; $from = utf8_html(join('/', @from)); - $to = PublicInbox::Hval->new_bin(join('/', @to), $orig_to); + $to = PublicInbox::Hval->utf8(join('/', @to), $orig_to); my $tp = $to->as_path; my $th = $to->as_html; $to = "$th"; diff --git a/lib/PublicInbox/RepoBrowseGitTree.pm b/lib/PublicInbox/RepoBrowseGitTree.pm index f0b15627c..275c562ed 100644 --- a/lib/PublicInbox/RepoBrowseGitTree.pm +++ b/lib/PublicInbox/RepoBrowseGitTree.pm @@ -105,7 +105,7 @@ sub git_tree_show { my @t; $t .= join('/', (map { push @t, $_; - my $e = PublicInbox::Hval->new_bin($_, join('/', @t)); + my $e = PublicInbox::Hval->utf8($_, join('/', @t)); my $ep = $e->as_path; my $eh = $e->as_html; "$eh"; @@ -129,7 +129,7 @@ sub git_tree_show { my ($m, $t, $x, $s, $path) = ($l =~ /\A(\S+) (\S+) (\S+)( *\S+)\t(.+)\z/s); $m = $GIT_MODE{$m} or next; - $path = PublicInbox::Hval->new_bin($path); + $path = PublicInbox::Hval->utf8($path); my $ref = $path->as_path; $path = $path->as_html;