git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 2/2] gitweb: Remove git_to_hash function
Date: Sun, 27 Aug 2006 23:45:26 +0200	[thread overview]
Message-ID: <200608272345.26722.jnareb@gmail.com> (raw)
In-Reply-To: <200608272343.14653.jnareb@gmail.com>

Remove git_to_hash function, which was to translate symbolic reference
to hash, and it's use in git_blobdiff.  We don't try so hard to guess
filename if it was not provided.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |   27 +++------------------------
 1 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 99c74f1..ae18c27 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -635,26 +635,6 @@ sub git_get_hash_by_path {
 	return $3;
 }
 
-# converts symbolic name to hash
-sub git_to_hash {
-	my @params = @_;
-	return undef unless @params;
-
-	open my $fd, "-|", $GIT, "rev-parse", @params
-		or return undef;
-	my @hashes = map { chomp; $_ } <$fd>;
-	close $fd;
-
-	if (wantarray) {
-		return @hashes;
-	} elsif (scalar(@hashes) == 1) {
-		# single hash
-		return $hashes[0];
-	} else {
-		return \@hashes;
-	}
-}
-
 ## ......................................................................
 ## git utility functions, directly accessing git repository
 
@@ -2739,10 +2719,9 @@ sub git_blobdiff {
 			@difftree
 				or die_error('404 Not Found', "Blob diff not found");
 
-		} elsif (defined $hash) { # try to find filename from $hash
-			if ($hash !~ /[0-9a-fA-F]{40}/) {
-				$hash = git_to_hash($hash);
-			}
+		} elsif (defined $hash &&
+		         $hash =~ /[0-9a-fA-F]{40}/) {
+			# try to find filename from $hash
 
 			# read filtered raw output
 			open $fd, "-|", $GIT, "diff-tree", '-r', @diff_opts, $hash_parent_base, $hash_base
-- 
1.4.1.1

  parent reply	other threads:[~2006-08-27 21:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-27 21:43 [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Jakub Narebski
2006-08-27 21:44 ` [PATCH 1/2] gitweb: Remove unused git_get_{preceding,following}_references Jakub Narebski
2006-08-27 21:45 ` Jakub Narebski [this message]
2006-08-27 22:22 ` [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Junio C Hamano
2006-08-31 19:32   ` [PATCH] gitweb: Remove forgotten call to git_to_hash Dennis Stosberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200608272345.26722.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).