gitweb: Make git_get_hash_by_path check type if provided
Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Sep 21, 2006 at 18:09 UTC
1d782b03b078c1a525cbb5728f6dc5eb06f06924
1 file changed
+5
gitweb/gitweb.perl
+5
@@ -718,6 +718,7 @@ sub git_get_project_config {
718
sub git_get_hash_by_path {
719
my $base = shift;
720
my $path = shift || return undef;
721
+ my $type = shift;
722
723
my $tree = $base;
724
@@ -728,6 +729,10 @@ sub git_get_hash_by_path {
729
730
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
731
$line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
732
+ if (defined $type && $type ne $2) {
733
+ # type doesn't match
734
+ return undef;
735
+ }
736
return $3;
737
}
738