Skip to content

Commit

Permalink
gitweb: Remove git_to_hash function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Aug 27, 2006
1 parent 023782b commit 0aea337
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -625,26 +625,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

Expand Down Expand Up @@ -2733,6 +2713,9 @@ sub git_blobdiff {
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', '-M', '-C', $hash_parent_base, $hash_base
Expand Down

0 comments on commit 0aea337

Please sign in to comment.