gitweb: Move git_get_last_activity subroutine earlier
PATCH 1/1 gitweb: Move git_get_last_activity subroutine earlier
---
Good test for git-pickaxe (git-blame2).
gitweb/gitweb.perl | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-)
gitweb/gitweb.perl +18 -18
@@ -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;
Signature · 1 line
1.4.3.3
Quoted 3 lines · Jakub Narebski
Signed-off-by Jakub Narebski <[email protected]>---
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.
Why is this needed?
Quoted 1 line · Junio C Hamano
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...
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
Quoted 10 lines · Jakub Narebski
Quoted 1 line · Junio C Hamano
Why is this needed?
This is purely cosmetic, and originally was to be first patch in series converting
git_summary,git_headsandgit_tagsto 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_activitybetween 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.