Skip to content

Commit

Permalink
gitweb: Move git_get_last_activity subroutine earlier
Browse files Browse the repository at this point in the history
This is purely cosmetic.  Having git_get_* between two parse_* subroutines
violated a good convention to group related things together.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Oct 28, 2006
1 parent 1dc5e55 commit c60c56c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit c60c56c

Please sign in to comment.