From: Jakub Narebski Date: Thu, 21 Sep 2006 16:09:12 GMT Subject: [PATCH] gitweb: Make git_get_hash_by_path check type if provided Message-ID: <200609211809.12260.jnareb@gmail.com> In-Reply-To: <200609211423.29729.jnareb@gmail.com> Signed-off-by: Jakub Narebski --- This patch depends textually (as context) from the previous patch. It can be applied using -C1 without applying previous patch first. gitweb/gitweb.perl | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 403bba1..7ed963c 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -718,6 +718,7 @@ # get hash of given path at given ref sub git_get_hash_by_path { my $base = shift; my $path = shift || return undef; + my $type = shift; $path =~ s,/+$,,; @@ -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; } -- 1.4.2.1