git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Make git_get_hash_by_path check type if provided

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 21, 2006, 16:09 UTC
Message-ID
<200609211809.12260.jnareb@gmail.com>
In-Reply-To
<200609211423.29729.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
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
Previous: Jakub Narebski
Message 2 of 2 in “gitweb: Strip trailing slashes from $path in git_get_hash_by_path”
  1. gitweb: Strip trailing slashes from $path in git_get_hash_by_pathJakub Narebski, Sep 21, 2006
  2. gitweb: Make git_get_hash_by_path check type if providedJakub Narebski, Sep 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.