Skip to content

Commit

Permalink
gitweb: Make git_get_hash_by_path check type if provided
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Sep 21, 2006
1 parent 16fdb48 commit 1d782b0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}

Expand Down

0 comments on commit 1d782b0

Please sign in to comment.