]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Move check-ref-format code into separate function
[Gitweb] / gitweb.perl
index 4c8c144e5180e68f472bcd32b6f6475c2d003dca0164541b377b7201b41fe306..a0e5de92696fea8d8ea945cdc979357d903a311dadeb3ef3c9508290be606de8 100755 (executable)
@@ -1453,6 +1453,16 @@ sub validate_pathname {
        return $input;
 }
 
+sub is_valid_ref_format {
+       my $input = shift || return undef;
+
+       # restrictions on ref name according to git-check-ref-format
+       if ($input =~ m!(/\.|\.\.|[\000-\040\177 ~^:?*\[]|/$)!) {
+               return undef;
+       }
+       return $input;
+}
+
 sub validate_refname {
        my $input = shift || return undef;
 
@@ -1463,10 +1473,9 @@ sub validate_refname {
        # it must be correct pathname
        $input = validate_pathname($input)
                or return undef;
-       # restrictions on ref name according to git-check-ref-format
-       if ($input =~ m!(/\.|\.\.|[\000-\040\177 ~^:?*\[]|/$)!) {
-               return undef;
-       }
+       # check git-check-ref-format restrictions
+       is_valid_ref_format($input)
+               or return undef;
        return $input;
 }
 
@@ -6632,6 +6641,7 @@ sub git_blame_common {
                        $hash_base, '--', $file_name
                        or die_error(500, "Open git-blame --porcelain failed");
        }
+       binmode $fd, ':utf8';
 
        # incremental blame data returns early
        if ($format eq 'data') {
This page took 0.203921 seconds and 4 git commands to generate.