threads / patch / 43393

patchRe: [PATCH] gitweb: Move git_get_last_activity subroutine earlier

Subject: Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier

## tl;dr

5 messages between Oct 28, 2006 and Oct 28, 2006. Diffs are folded; open one to read it.

replies: 4people: 2as markdown or json

Jakub Narebski· Oct 28, 2006, 17:43 UTC · lore

[PATCH] gitweb: Move git_get_last_activity subroutine earlier

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Good test for git-pickaxe (git-blame2).
 gitweb/gitweb.perl |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
Show changes to gitweb/gitweb.perl +18 −18
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 5f6a562..cbab3c9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -976,6 +976,24 @@ sub git_get_project_owner {
 	return $owner;
 }
 
+sub git_get_last_activity {
+	my ($path) = @_;
+	my $fd;
+
+	$git_dir = "$projectroot/$path";
+	open($fd, "-|", git_cmd(), 'for-each-ref',
+	     '--format=%(refname) %(committer)',
+	     '--sort=-committerdate',
+	     'refs/heads') or return;
+	my $most_recent = <$fd>;
+	close $fd or return;
+	if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
+		my $timestamp = $1;
+		my $age = time - $timestamp;
+		return ($age, age_string($age));
+	}
+}
+
 sub git_get_references {
 	my $type = shift || "";
 	my %refs;
@@ -1082,24 +1100,6 @@ sub parse_tag {
 	return %tag
 }
 
-sub git_get_last_activity {
-	my ($path) = @_;
-	my $fd;
-
-	$git_dir = "$projectroot/$path";
-	open($fd, "-|", git_cmd(), 'for-each-ref',
-	     '--format=%(refname) %(committer)',
-	     '--sort=-committerdate',
-	     'refs/heads') or return;
-	my $most_recent = <$fd>;
-	close $fd or return;
-	if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
-		my $timestamp = $1;
-		my $age = time - $timestamp;
-		return ($age, age_string($age));
-	}
-}
-
 sub parse_commit {
 	my $commit_id = shift;
 	my $commit_text = shift;
-- 
1.4.3.3
Jakub Narebski· Oct 28, 2006, 19:20 UTC · re: Junio C Hamano · lore
Junio C Hamano wrote:
> Why is this needed?
 
This is purely cosmetic, and originally was to be first patch in series
converting git_summary, git_heads and git_tags to use of git-for-each-ref...
but unfortunately git-for-each-ref lacks sorting on taggerdate OR
committerdate (i.e. use taggerdate if applicable, committerdate otherwise).
I'd rather not have git_get_last_activity between two parse_* subroutines...
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Junio C Hamano· Oct 28, 2006, 19:24 UTC · re: Jakub Narebski · lore
Jakub Narebski <jnareb@gmail.com> writes:
Show 10 quoted lines
> Junio C Hamano wrote:
>
>> Why is this needed?
>  
> This is purely cosmetic, and originally was to be first patch in series
> converting git_summary, git_heads and git_tags to use of git-for-each-ref...
> but unfortunately git-for-each-ref lacks sorting on taggerdate OR
> committerdate (i.e. use taggerdate if applicable, committerdate otherwise).
>
> I'd rather not have git_get_last_activity between two parse_* subroutines...

Ok, will apply but the last line of your response _should_ have been in the proposed commit log message without being asked.

Junio C Hamano· Oct 28, 2006, 20:57 UTC · re: Jakub Narebski · lore
Jakub Narebski <jnareb@gmail.com> writes:
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> Good test for git-pickaxe (git-blame2).

"git pickaxe -M v1.4.3.. -- gitweb/gitweb.perl" finds copies by you just fine (It is interesting to compare it with output without -M), thanks.

← back to recent threads