# [PATCH] Speed up history generation

6 messages from 2006-07-01 to 2006-07-01. Participants: Luben Tuikov, Junio C Hamano, Linus Torvalds.
Thread: https://gitlist.dev/t/4723

## Luben Tuikov, 2006-07-01 00:59

Subject: [PATCH] Speed up history generation
Message-ID: <20060701005924.7726.qmail@web31812.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060701005924.7726.qmail%40web31812.mail.mud.yahoo.com

```
Speed up history generation as suggested by Linus.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 035e76d..2705a93 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -2295,16 +2295,12 @@ sub git_history {
 	      "</div>\n";
 	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
 
-	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
\'$file_name\'";
-	my $commit;
+	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
 	while (my $line = <$fd>) {
 		if ($line =~ m/^([0-9a-fA-F]{40})/){
-			$commit = $1;
-			next;
-		}
-		if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/ &&
(defined $commit)) {
+			my $commit = $1;
 			my %co = git_read_commit($commit);
 			if (!%co) {
 				next;
@@ -2336,7 +2332,6 @@ sub git_history {
 			}
 			print "</td>\n" .
 			      "</tr>\n";
-			undef $commit;
 		}
 	}
 	print "</table>\n";
-- 
1.4.1.rc2.g4ce4

```

## Junio C Hamano, 2006-07-01 01:04

Subject: Re: [PATCH] Speed up history generation
Message-ID: <7v7j2ygmou.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v7j2ygmou.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060701005924.7726.qmail@web31812.mail.mud.yahoo.com>

```
Luben Tuikov <ltuikov@yahoo.com> writes:

> Speed up history generation as suggested by Linus.
> @@ -2295,16 +2295,12 @@ sub git_history {
>  	      "</div>\n";
>  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
>  
> -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> \'$file_name\'";
> -	my $commit;
> +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";

This would speed things up but at the same time it changes the
semantics because it involves merge simplification, no?

At least that should be noted in the commit log.

```

## Luben Tuikov, 2006-07-01 01:11

Subject: Re: [PATCH] Speed up history generation
Message-ID: <20060701011112.892.qmail@web31813.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060701011112.892.qmail%40web31813.mail.mud.yahoo.com
In-Reply-To: <7v7j2ygmou.fsf@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > Speed up history generation as suggested by Linus.
> > @@ -2295,16 +2295,12 @@ sub git_history {
> >  	      "</div>\n";
> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >  
> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> > \'$file_name\'";
> > -	my $commit;
> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> 
> This would speed things up but at the same time it changes the
> semantics because it involves merge simplification, no?
> 
> At least that should be noted in the commit log.

Ok, I guess this should be in the log.  Can you add it please when
commiting to the master git branch?

   Luben

```

## Linus Torvalds, 2006-07-01 01:20

Subject: Re: [PATCH] Speed up history generation
Message-ID: <Pine.LNX.4.64.0606301818480.12404@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0606301818480.12404%40g5.osdl.org
In-Reply-To: <7v7j2ygmou.fsf@assigned-by-dhcp.cox.net>

```


On Fri, 30 Jun 2006, Junio C Hamano wrote:

> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > Speed up history generation as suggested by Linus.
> > @@ -2295,16 +2295,12 @@ sub git_history {
> >  	      "</div>\n";
> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >  
> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> > \'$file_name\'";
> > -	my $commit;
> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> 
> This would speed things up but at the same time it changes the
> semantics because it involves merge simplification, no?

Or just add a flag or config option that enables "--full-history" on that 
git-rev-list. Perhaps it should be the default fir gitweb.

With --full-history, it should still be better to do this inside 
git-rev-list than piping things into git-diff-tree just to limit by 
pathname..

		Linus

```

## Junio C Hamano, 2006-07-01 01:20

Subject: Re: [PATCH] Speed up history generation
Message-ID: <7v3bdmglxo.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v3bdmglxo.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060701011112.892.qmail@web31813.mail.mud.yahoo.com>

```
Luben Tuikov <ltuikov@yahoo.com> writes:

> --- Junio C Hamano <junkio@cox.net> wrote:
>...
>> > @@ -2295,16 +2295,12 @@ sub git_history {
>> >  	      "</div>\n";
>> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
>> >  
>> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
>> > \'$file_name\'";
>> > -	my $commit;
>> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
>> 
>> This would speed things up but at the same time it changes the
>> semantics because it involves merge simplification, no?
>> 
>> At least that should be noted in the commit log.
>
> Ok, I guess this should be in the log.  Can you add it please when
> commiting to the master git branch?

Well, by "at least", what I meant was that it might make sense
to pass "--full-history" option to be more compatible with the
original output.  For graphical output like gitk, --full-history
makes a mess on the screen, but a list-oriented output like
gitweb it might be less confusing to show all the alternate
paths that touched the path than leaving some histories out.

```

## Luben Tuikov, 2006-07-01 01:52

Subject: Re: [PATCH] Speed up history generation
Message-ID: <20060701015204.17216.qmail@web31813.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/20060701015204.17216.qmail%40web31813.mail.mud.yahoo.com
In-Reply-To: <7v3bdmglxo.fsf@assigned-by-dhcp.cox.net>

```
--- Junio C Hamano <junkio@cox.net> wrote:
> Luben Tuikov <ltuikov@yahoo.com> writes:
> 
> > --- Junio C Hamano <junkio@cox.net> wrote:
> >...
> >> > @@ -2295,16 +2295,12 @@ sub git_history {
> >> >  	      "</div>\n";
> >> >  	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
> >> >  
> >> > -	open my $fd, "-|", "$gitbin/git-rev-list $hash | $gitbin/git-diff-tree -r --stdin --
> >> > \'$file_name\'";
> >> > -	my $commit;
> >> > +	open my $fd, "-|", "$gitbin/git-rev-list $hash -- \'$file_name\'";
> >> 
> >> This would speed things up but at the same time it changes the
> >> semantics because it involves merge simplification, no?
> >> 
> >> At least that should be noted in the commit log.
> >
> > Ok, I guess this should be in the log.  Can you add it please when
> > commiting to the master git branch?
> 
> Well, by "at least", what I meant was that it might make sense
> to pass "--full-history" option to be more compatible with the
> original output.  For graphical output like gitk, --full-history
> makes a mess on the screen, but a list-oriented output like
> gitweb it might be less confusing to show all the alternate
> paths that touched the path than leaving some histories out.

Ok, I can add the --full-history option, test it out and resubmit.

    Luben

```
