git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gitweb: Get rid of failed experiments ;-)
@ 2006-08-27 21:43 Jakub Narebski
  2006-08-27 21:44 ` [PATCH 1/2] gitweb: Remove unused git_get_{preceding,following}_references Jakub Narebski
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jakub Narebski @ 2006-08-27 21:43 UTC (permalink / raw)
  To: git

Remove unused subroutines or subroutines which don't work correctly from 
gitweb.

-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] gitweb: Remove unused git_get_{preceding,following}_references
  2006-08-27 21:43 [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Jakub Narebski
@ 2006-08-27 21:44 ` Jakub Narebski
  2006-08-27 21:45 ` [PATCH 2/2] gitweb: Remove git_to_hash function Jakub Narebski
  2006-08-27 22:22 ` [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2006-08-27 21:44 UTC (permalink / raw)
  To: git

Remove unused (and with errors in implementation)
git_get_{preceding,following}_references subroutines.

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

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ba5024a..6918947 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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;
 
-- 
1.4.1.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gitweb: Remove git_to_hash function
  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
  2006-08-27 22:22 ` [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2006-08-27 21:45 UTC (permalink / raw)
  To: git

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] gitweb: Get rid of failed experiments ;-)
  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 ` [PATCH 2/2] gitweb: Remove git_to_hash function Jakub Narebski
@ 2006-08-27 22:22 ` Junio C Hamano
  2006-08-31 19:32   ` [PATCH] gitweb: Remove forgotten call to git_to_hash Dennis Stosberg
  2 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2006-08-27 22:22 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> 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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] gitweb: Remove forgotten call to git_to_hash
  2006-08-27 22:22 ` [PATCH 0/2] gitweb: Get rid of failed experiments ;-) Junio C Hamano
@ 2006-08-31 19:32   ` Dennis Stosberg
  0 siblings, 0 replies; 5+ messages in thread
From: Dennis Stosberg @ 2006-08-31 19:32 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, git

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 <200608272345.26722.jnareb@gmail.com>

Signed-off-by: Dennis Stosberg <dennis@stosberg.net>
---
 gitweb/gitweb.perl |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9324d71..68f40bd 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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
-- 
1.4.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-31 19:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] gitweb: Remove git_to_hash function Jakub Narebski
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

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).