]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Make git_get_hash_by_path check type if provided
authorJakub Narebski <redacted>
Thu, 21 Sep 2006 16:09:12 +0000 (18:09 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:10 +0000 (00:07 -0400)
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index a308c0a30be5e5f207d6da8bc95b3c37e8d8d0e80881b3521d409a33dcf829ab..8c306320bc01a7d17de6867f2affb878c1e14a72328b8e4130c12cd4febe02ca 100755 (executable)
@@ -718,6 +718,7 @@ sub git_get_project_config {
 sub git_get_hash_by_path {
        my $base = shift;
        my $path = shift || return undef;
+       my $type = shift;
 
        my $tree = $base;
 
@@ -728,6 +729,10 @@ sub git_get_hash_by_path {
 
        #'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa  panic.c'
        $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
+       if (defined $type && $type ne $2) {
+               # type doesn't match
+               return undef;
+       }
        return $3;
 }
 
This page took 0.238069 seconds and 4 git commands to generate.