gitweb: Get rid of failed experiments ;-)
cover gitweb: Get rid of failed experiments ;-)
Remove unused subroutines or subroutines which don't work correctly from gitweb.
Signature · 2 lines
Jakub Narebski Poland
PATCH 1/2 gitweb: Remove unused git_get_{preceding,following}_references
Remove unused (and with errors in implementation) git_get_{preceding,following}_references subroutines.
--- gitweb/gitweb.perl | 51 --------------------------------------------------- 1 files changed, 0 insertions(+), 51 deletions(-)
gitweb/gitweb.perl +0 -51
@@ -784,57 +784,6 @@ sub git_get_references { return \%refs; } -sub git_get_following_references { - my $hash = shift || return undef; - my $type = shift; - my $base = shift || $hash_base || "HEAD"; - - my $refs = git_get_references($type); - open my $fd, "-|", $GIT, "rev-list", $base - or return undef; - my @commits = map { chomp; $_ } <$fd>; - close $fd - or return undef; - - my @reflist; - my $lastref; - - foreach my $commit (@commits) { - foreach my $ref (@{$refs->{$commit}}) { - $lastref = $ref; - push @reflist, $lastref; - } - if ($commit eq $hash) { - last; - } - } - - return wantarray ? @reflist : $lastref; -} - -sub git_get_preceding_references { - my $hash = shift || return undef; - my $type = shift; - - my $refs = git_get_references($type); - open my $fd, "-|", $GIT, "rev-list", $hash - or return undef; - my @commits = map { chomp; $_ } <$fd>; - close $fd - or return undef; - - my @reflist; - - foreach my $commit (@commits) { - foreach my $ref (@{$refs->{$commit}}) { - return $ref unless wantarray; - push @reflist, $ref; - } - } - - return @reflist; -} - sub git_get_rev_name_tags { my $hash = shift || return undef;
Signature · 1 line
1.4.1.1
PATCH 2/2 gitweb: Remove git_to_hash function
In reply to Jakub NarebskiRemove 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.
--- gitweb/gitweb.perl | 27 +++------------------------ 1 files changed, 3 insertions(+), 24 deletions(-)
gitweb/gitweb.perl +3 -24
@@ -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
Signature · 1 line
1.4.1.1
Quoted 2 lines · Jakub Narebski
Remove unused subroutines or subroutines which don't work correctly from gitweb.
I'll apply both, thanks. [2/2] had a fuzz at the very end of the second hunk (your base version do not have -M to diff-tree parameter anymore) but that was easy to deal with.
Also thanks for the reminder about "typo in git_patchset_body".
PATCH 1/1 gitweb: Remove forgotten call to git_to_hash
On Aug 27th, Jakub Narebski sent a patch which removed the git_to_hash() function and this call to it. The patch did not apply cleanly and had to be applied manually. Removing the last chunk has obviously been forgotten.
See: commit 0aea33762b1262d11fb43eda9f3fc152b5622cca and
message <[email protected]>
--- gitweb/gitweb.perl | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
gitweb/gitweb.perl +0 -4
@@ -2778,10 +2778,6 @@ 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
Signature · 1 line
1.4.2