threads / patch / 6082

patch, 4 partsgitweb: Add missing show '...' links change.

Subject: [PATCH 1/4] gitweb: Add missing show '...' links change.

## tl;dr

8 messages between Dec 22, 2006 and Dec 22, 2006. Diffs are folded; open one to read it.

replies: 7people: 3as markdown or json

Robert Fitzsimons· Dec 22, 2006, 19:38 UTC · lore

Part of the patch for "gitweb: Show '...' links in "summary" view only if there are more items" (313ce8cee665447e4476d7e8985b270346a8e5a1) is missing. Add it back in.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---

With all the tooing and frowing this part of the original patch got lost. I'm also resubmiting the original optimizations patches with a few changes.

Robert
 gitweb/gitweb.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to gitweb/gitweb.perl +1 −0
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ebbc397..80c04b8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2983,6 +2983,7 @@ sub git_summary {
 	if (@forklist) {
 		git_print_header_div('forks');
 		git_project_list_body(\@forklist, undef, 0, 15,
+		                      $#forklist <= 15 ? undef :
 		                      $cgi->a({-href => href(action=>"forks")}, "..."),
 				      'noheader');
 	}
-- 
1.4.4.3.gc902c
Robert Fitzsimons· Dec 22, 2006, 19:38 UTC · re: Robert Fitzsimons · lore

Part of the patch for "gitweb: Show '...' links in "summary" view only if there are more items" (313ce8cee665447e4476d7e8985b270346a8e5a1) is missing. Add it back in.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---

With all the tooing and frowing this part of the original patch got lost. I'm also resubmiting the original optimizations patches with a few changes.

Robert
 gitweb/gitweb.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to gitweb/gitweb.perl +1 −0
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ebbc397..80c04b8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2983,6 +2983,7 @@ sub git_summary {
 	if (@forklist) {
 		git_print_header_div('forks');
 		git_project_list_body(\@forklist, undef, 0, 15,
+		                      $#forklist <= 15 ? undef :
 		                      $cgi->a({-href => href(action=>"forks")}, "..."),
 				      'noheader');
 	}
-- 
1.4.4.3.gc902c
Robert Fitzsimons· Dec 22, 2006, 19:38 UTC · re: Robert Fitzsimons · lore

[PATCH 2/4] gitweb: optimize git_get_last_activity.

Only return one line of output and we don't need the refname value.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to gitweb/gitweb.perl +2 −1
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 80c04b8..01e3a8a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1139,8 +1139,9 @@ sub git_get_last_activity {
 
 	$git_dir = "$projectroot/$path";
 	open($fd, "-|", git_cmd(), 'for-each-ref',
-	     '--format=%(refname) %(committer)',
+	     '--format=%(committer)',
 	     '--sort=-committerdate',
+	     '--count=1',
 	     'refs/heads') or return;
 	my $most_recent = <$fd>;
 	close $fd or return;
-- 
1.4.4.3.gc902c
Robert Fitzsimons· Dec 22, 2006, 19:38 UTC · re: Robert Fitzsimons · lore

[PATCH 3/4] gitweb: optimize git_shortlog_body.

Don't call gitweb_have_snapshot from within the loop.
Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 gitweb/gitweb.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to gitweb/gitweb.perl +3 −1
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 01e3a8a..d2ddac8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2636,6 +2636,8 @@ sub git_shortlog_body {
 	# uses global variable $project
 	my ($revlist, $from, $to, $refs, $extra) = @_;
 
+	my $have_snapshot = gitweb_have_snapshot();
+
 	$from = 0 unless defined $from;
 	$to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);
 
@@ -2663,7 +2665,7 @@ sub git_shortlog_body {
 		      $cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
 		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
-		if (gitweb_have_snapshot()) {
+		if ($have_snapshot) {
 			print " | " . $cgi->a({-href => href(action=>"snapshot", hash=>$commit)}, "snapshot");
 		}
 		print "</td>\n" .
-- 
1.4.4.3.gc902c
Robert Fitzsimons· Dec 22, 2006, 19:38 UTC · re: Robert Fitzsimons · lore

[PATCH 4/4] gitweb: optimize git_summary.

We don't need to call git_get_head_hash at all just pass in "HEAD" and use the return id field.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net>
---
 gitweb/gitweb.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to gitweb/gitweb.perl +3 −3
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d2ddac8..b0e6fdf 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2911,9 +2911,9 @@ sub git_project_index {
 
 sub git_summary {
 	my $descr = git_get_project_description($project) || "none";
-	my $head = git_get_head_hash($project);
-	my %co = parse_commit($head);
+	my %co = parse_commit("HEAD");
 	my %cd = parse_date($co{'committer_epoch'}, $co{'committer_tz'});
+	my $head = $co{'id'};
 
 	my $owner = git_get_project_owner($project);
 
@@ -2960,7 +2960,7 @@ sub git_summary {
 	# we need to request one more than 16 (0..15) to check if
 	# those 16 are all
 	open my $fd, "-|", git_cmd(), "rev-list", "--max-count=17",
-		git_get_head_hash($project), "--"
+		$head, "--"
 		or die_error(undef, "Open git-rev-list failed");
 	my @revlist = map { chomp; $_ } <$fd>;
 	close $fd;
-- 
1.4.4.3.gc902c
Jakub Narebski· Dec 22, 2006, 20:07 UTC · re: Robert Fitzsimons · lore

Re: [PATCH 2/4] gitweb: optimize git_get_last_activity.

Robert Fitzsimons wrote:
> Only return one line of output and we don't need the refname value.

Refname doesn't hurt and we have it "for free" (meaning: we have to calculate it anyway to get commiterepoch). Although we do not use it.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Jakub Narebski· Dec 22, 2006, 20:09 UTC · re: Robert Fitzsimons · lore

Re: [PATCH 1/4] gitweb: Add missing show '...' links change.

Robert Fitzsimons wrote:
> I'm also resubmiting the original optimizations patches with a
> few changes.
Nice series of patches. Ack (FWIW).
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Junio C Hamano· Dec 22, 2006, 21:52 UTC · re: Jakub Narebski · lore

Re: [PATCH 1/4] gitweb: Add missing show '...' links change.

Jakub Narebski <jnareb@gmail.com> writes:
Show 6 quoted lines
> Robert Fitzsimons wrote:
>
>> I'm also resubmiting the original optimizations patches with a
>> few changes.
>
> Nice series of patches. Ack (FWIW).
Thanks both.

← back to recent threads