[PATCH] gitweb: Make git_get_hash_by_path check type if provided

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>
---
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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]