gitweb: Remove git_to_hash function
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Aug 27, 2006 at 23:45 UTC
0aea33762b1262d11fb43eda9f3fc152b5622cca
1 file changed
+3
-20
gitweb/gitweb.perl
+3
-20
@@ -625,26 +625,6 @@ sub git_get_hash_by_path {
625
return $3;
626
}
627
628
-# converts symbolic name to hash
629
-sub git_to_hash {
630
- my @params = @_;
631
- return undef unless @params;
632
-
633
- open my $fd, "-|", $GIT, "rev-parse", @params
634
- or return undef;
635
- my @hashes = map { chomp; $_ } <$fd>;
636
- close $fd;
637
-
638
- if (wantarray) {
639
- return @hashes;
640
- } elsif (scalar(@hashes) == 1) {
641
- # single hash
642
- return $hashes[0];
643
- } else {
644
- return \@hashes;
645
- }
646
-}
647
-
628
## ......................................................................
629
## git utility functions, directly accessing git repository
630
@@ -2733,6 +2713,9 @@ sub git_blobdiff {
2713
if ($hash !~ /[0-9a-fA-F]{40}/) {
2714
$hash = git_to_hash($hash);
2715
}
2716
+ } elsif (defined $hash &&
2717
+ $hash =~ /[0-9a-fA-F]{40}/) {
2718
+ # try to find filename from $hash
2719
2720
# read filtered raw output
2721
open $fd, "-|", $GIT, "diff-tree", '-r', '-M', '-C', $hash_parent_base, $hash_base