]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
hval: rename new_bin => utf8
authorEric Wong <e@80x24.org>
Sat, 26 Dec 2015 04:35:22 +0000 (04:35 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
This shorter name is more descriptive of what the method
actually does.

lib/PublicInbox/Hval.pm
lib/PublicInbox/RepoBrowseGitCommit.pm
lib/PublicInbox/RepoBrowseGitTree.pm

index 2974c683865ff3cfe114ce84e45b11e8b59ae8dc..c38ef7d8edef7567b6ac768a360605c195e245f0 100644 (file)
@@ -21,7 +21,7 @@ use constant PRE => "<pre\nstyle=\"white-space:pre-wrap\">"; # 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);
index c70b1d1b4ba85d73d178d0415cb26f300602b69c..a5c98c57df9844de2cc7f9dcdaedd67698a1f095 100644 (file)
@@ -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;
                        "<a\nhref=\"${rel}tree/$ep?id=$h\">$eh</a>";
@@ -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 = "<a\nhref=\"${rel}commit/$lp?id=$h\">$lh</a>";
@@ -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 <b>$html_path</b>";
 }
@@ -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 = "<a\nhref=\"${rel}/commit/$tp?id=$h\">$th</a>";
index f0b15627cf1b2e9ceb6046f3912a13005e9f5e45..275c562ed5fa6b22d6c2d10dbab3d14b9cf155a3 100644 (file)
@@ -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;
                        "<a\nhref=\"${rel}tree/$ep$qs\">$eh</a>";
@@ -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;