@matheusbsbs / matheus-bagliano / commits / c60c56cc70
Fork 0

gitweb: Move git_get_last_activity subroutine earlier

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>

Jakub Narebski committed Oct 28, 2006 at 19:43 UTC c60c56cc70dbf2acb4d15e3ea4f95d09020acc82
1 file changed +18 -18
gitweb/gitweb.perl
+18 -18
@@ -976,6 +976,24 @@ sub git_get_project_owner {
976 return $owner;
977 }
978
979 +sub git_get_last_activity {
980 + my ($path) = @_;
981 + my $fd;
982 +
983 + $git_dir = "$projectroot/$path";
984 + open($fd, "-|", git_cmd(), 'for-each-ref',
985 + '--format=%(refname) %(committer)',
986 + '--sort=-committerdate',
987 + 'refs/heads') or return;
988 + my $most_recent = <$fd>;
989 + close $fd or return;
990 + if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
991 + my $timestamp = $1;
992 + my $age = time - $timestamp;
993 + return ($age, age_string($age));
994 + }
995 +}
996 +
997 sub git_get_references {
998 my $type = shift || "";
999 my %refs;
@@ -1082,24 +1100,6 @@ sub parse_tag {
1100 return %tag
1101 }
1102
1085 -sub git_get_last_activity {
1086 - my ($path) = @_;
1087 - my $fd;
1088 -
1089 - $git_dir = "$projectroot/$path";
1090 - open($fd, "-|", git_cmd(), 'for-each-ref',
1091 - '--format=%(refname) %(committer)',
1092 - '--sort=-committerdate',
1093 - 'refs/heads') or return;
1094 - my $most_recent = <$fd>;
1095 - close $fd or return;
1096 - if ($most_recent =~ / (\d+) [-+][01]\d\d\d$/) {
1097 - my $timestamp = $1;
1098 - my $age = time - $timestamp;
1099 - return ($age, age_string($age));
1100 - }
1101 -}
1102 -
1103 sub parse_commit {
1104 my $commit_id = shift;
1105 my $commit_text = shift;