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

8 messages from 2006-12-22 to 2006-12-22. Participants: Robert Fitzsimons, Jakub Narebski, Junio C Hamano.
Thread: https://gitlist.dev/t/6082

## Robert Fitzsimons, 2006-12-22 19:38

Subject: [PATCH 1/4] gitweb: Add missing show '...' links change.
Message-ID: <11668162952375-git-send-email-robfitz@273k.net>
URL: https://gitlist.dev/e/11668162952375-git-send-email-robfitz%40273k.net

```
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(-)

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, 2006-12-22 19:38

Subject: [PATCH 1/4] gitweb: Add missing show '...' links change.
Message-ID: <11668162961084-git-send-email-robfitz@273k.net>
URL: https://gitlist.dev/e/11668162961084-git-send-email-robfitz%40273k.net
In-Reply-To: <11668162952375-git-send-email-robfitz@273k.net>

```
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(-)

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, 2006-12-22 19:38

Subject: [PATCH 2/4] gitweb: optimize git_get_last_activity.
Message-ID: <11668162963671-git-send-email-robfitz@273k.net>
URL: https://gitlist.dev/e/11668162963671-git-send-email-robfitz%40273k.net
In-Reply-To: <11668162961084-git-send-email-robfitz@273k.net>

```
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(-)

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, 2006-12-22 19:38

Subject: [PATCH 3/4] gitweb: optimize git_shortlog_body.
Message-ID: <11668162963240-git-send-email-robfitz@273k.net>
URL: https://gitlist.dev/e/11668162963240-git-send-email-robfitz%40273k.net
In-Reply-To: <11668162963671-git-send-email-robfitz@273k.net>

```
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(-)

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, 2006-12-22 19:38

Subject: [PATCH 4/4] gitweb: optimize git_summary.
Message-ID: <11668162972414-git-send-email-robfitz@273k.net>
URL: https://gitlist.dev/e/11668162972414-git-send-email-robfitz%40273k.net
In-Reply-To: <11668162963240-git-send-email-robfitz@273k.net>

```
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(-)

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, 2006-12-22 20:07

Subject: Re: [PATCH 2/4] gitweb: optimize git_get_last_activity.
Message-ID: <emhdpg$he9$2@sea.gmane.org>
URL: https://gitlist.dev/e/emhdpg%24he9%242%40sea.gmane.org
In-Reply-To: <11668162963671-git-send-email-robfitz@273k.net>

```
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, 2006-12-22 20:09

Subject: Re: [PATCH 1/4] gitweb: Add missing show '...' links change.
Message-ID: <emhdru$he9$3@sea.gmane.org>
URL: https://gitlist.dev/e/emhdru%24he9%243%40sea.gmane.org
In-Reply-To: <11668162952375-git-send-email-robfitz@273k.net>

```
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, 2006-12-22 21:52

Subject: Re: [PATCH 1/4] gitweb: Add missing show '...' links change.
Message-ID: <7vtzznwqbq.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vtzznwqbq.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <emhdru$he9$3@sea.gmane.org>

```
Jakub Narebski <jnareb@gmail.com> writes:

> Robert Fitzsimons wrote:
>
>> I'm also resubmiting the original optimizations patches with a
>> few changes.
>
> Nice series of patches. Ack (FWIW).

Thanks both.

```
