{"thread":{"id":"5928","subject":"gitweb.cgi feature request: project list \"last change\" column to display last change of all heads.","startedAt":"2006-10-15T09:16:39Z","lastAt":"2006-10-15T12:17:37Z","messageCount":3,"participants":["Pierre Marc Dumuid","Junio C Hamano","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"28794","messageId":"4531FC77.6010004@adelaide.edu.au","threadId":"5928","inReplyTo":null,"subject":"gitweb.cgi feature request: project list \"last change\" column to display last change of all heads.","fromName":"Pierre Marc Dumuid","fromEmail":"pierre.dumuid@adelaide.edu.au","sentAt":"2006-10-15T09:16:39Z","receivedAt":"2006-10-15T09:16:39Z","isPatch":false,"sender":{"key":"pierre.dumuid@adelaide.edu.au","avatar":null},"body":" Hi,\n I am working with the cinelerra-CV group (cvs.cinelerra.org) and we are \n starting to use git to develop new patches.  Someone has offered to \n mirror our git branches to share amongst ourselves at \n http://www.pipapo.org/gitweb.\n \n The annoying thing is that in our mirrored personal repositories, we \n switch from head to head and push new features in different head, and \n then wait for the other developers to review.  At the moment, the \n getweb.cgi script only shows the \"Last Change\" for the current branch, \n and not all branches, (i.e. it's currently showing \"13 days ago\" for \n cinelerra-pmdumuid, whilst if you click the summary, you'll see I \n actually extended one of the branches only \"24 hours ago\".\n \n 2nd feature request it the ability to browse to the next / previous \n commit when looking at a commitdiff...\n"},{"id":"28795","messageId":"7vfydpzxe0.fsf@assigned-by-dhcp.cox.net","threadId":"5928","inReplyTo":"4531FC77.6010004@adelaide.edu.au","subject":"Re: gitweb.cgi feature request: project list \"last change\" column to display last change of all heads.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-15T10:28:07Z","receivedAt":"2006-10-15T10:28:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pierre Marc Dumuid <pierre.dumuid@adelaide.edu.au> writes:\n\n> The annoying thing is that in our mirrored personal repositories, we\n> switch from head to head and push new features in different head, and\n> then wait for the other developers to review.  At the moment, the\n> getweb.cgi script only shows the \"Last Change\" for the current branch,\n> and not all branches, (i.e. it's currently showing \"13 days ago\" for\n> cinelerra-pmdumuid, whilst if you click the summary, you'll see I\n> actually extended one of the branches only \"24 hours ago\".\n\nIt is fairly expensive to do without recent core-side support,\nbut if the site runs version of git from the \"next\" branch,\nyou should be able to do something like this.\n\nI'll queue this to \"next\".\n\n-- >8 --\ngitweb: use for-each-ref to show the latest activity across branches\n\nThe project list page shows last change from the HEAD branch but\noften people would want to view activity on any branch.\n\nUnfortunately that is fairly expensive without the core-side\nsupport.  for-each-ref was invented exactly for that.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex e4ebce6..a78c8db 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1009,6 +1009,24 @@ sub parse_tag {\n \treturn %tag\n }\n \n+sub git_get_last_activity {\n+\tmy ($path) = @_;\n+\tmy $fd;\n+\n+\t$git_dir = \"$projectroot/$path\";\n+\topen($fd, \"-|\", git_cmd(), 'for-each-ref', \n+\t     '--format=%(refname) %(committer)',\n+\t     '--sort=-committerdate',\n+\t     'refs/heads') or return;\n+\tmy $most_recent = <$fd>;\n+\tclose $fd or return;\n+\tif ($most_recent =~ / (\\d+) [-+][01]\\d\\d\\d$/) {\n+\t\tmy $timestamp = $1;\n+\t\tmy $age = time - $timestamp;\n+\t\treturn ($age, age_string($age));\n+\t}\n+}\n+\n sub parse_commit {\n \tmy $commit_id = shift;\n \tmy $commit_text = shift;\n@@ -2258,16 +2276,11 @@ sub git_project_list {\n \t\tdie_error(undef, \"No projects found\");\n \t}\n \tforeach my $pr (@list) {\n-\t\tmy $head = git_get_head_hash($pr->{'path'});\n-\t\tif (!defined $head) {\n-\t\t\tnext;\n-\t\t}\n-\t\t$git_dir = \"$projectroot/$pr->{'path'}\";\n-\t\tmy %co = parse_commit($head);\n-\t\tif (!%co) {\n+\t\tmy (@aa) = git_get_last_activity($pr->{'path'});\n+\t\tunless (@aa) {\n \t\t\tnext;\n \t\t}\n-\t\t$pr->{'commit'} = \\%co;\n+\t\t($pr->{'age'}, $pr->{'age_string'}) = @aa;\n \t\tif (!defined $pr->{'descr'}) {\n \t\t\tmy $descr = git_get_project_description($pr->{'path'}) || \"\";\n \t\t\t$pr->{'descr'} = chop_str($descr, 25, 5);\n@@ -2317,7 +2330,7 @@ sub git_project_list {\n \t\t      \"</th>\\n\";\n \t}\n \tif ($order eq \"age\") {\n-\t\t@projects = sort {$a->{'commit'}{'age'} <=> $b->{'commit'}{'age'}} @projects;\n+\t\t@projects = sort {$a->{'age'} <=> $b->{'age'}} @projects;\n \t\tprint \"<th>Last Change</th>\\n\";\n \t} else {\n \t\tprint \"<th>\" .\n@@ -2339,8 +2352,8 @@ sub git_project_list {\n \t\t                        -class => \"list\"}, esc_html($pr->{'path'})) . \"</td>\\n\" .\n \t\t      \"<td>\" . esc_html($pr->{'descr'}) . \"</td>\\n\" .\n \t\t      \"<td><i>\" . chop_str($pr->{'owner'}, 15) . \"</i></td>\\n\";\n-\t\tprint \"<td class=\\\"\". age_class($pr->{'commit'}{'age'}) . \"\\\">\" .\n-\t\t      $pr->{'commit'}{'age_string'} . \"</td>\\n\" .\n+\t\tprint \"<td class=\\\"\". age_class($pr->{'age'}) . \"\\\">\" .\n+\t\t      $pr->{'age_string'} . \"</td>\\n\" .\n \t\t      \"<td class=\\\"link\\\">\" .\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"summary\")}, \"summary\")   . \" | \" .\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"shortlog\")}, \"shortlog\") . \" | \" .\n"},{"id":"28798","messageId":"egt8sk$99u$1@sea.gmane.org","threadId":"5928","inReplyTo":"4531FC77.6010004@adelaide.edu.au","subject":"Re: gitweb.cgi feature request: project list \"last change\" column to display last change of all heads.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-15T12:17:37Z","receivedAt":"2006-10-15T12:17:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Pierre Marc Dumuid wrote:\n\n>  I am working with the Cinelerra-CV group (cvs.cinelerra.org) and we are \n>  starting to use git to develop new patches.  Someone has offered to \n>  mirror our git branches to share amongst ourselves at \n>  http://www.pipapo.org/gitweb.\n>  \n>  The annoying thing is that in our mirrored personal repositories, we \n>  switch from head to head and push new features in different head, and \n>  then wait for the other developers to review.  At the moment, the \n>  getweb.cgi script only shows the \"Last Change\" for the current branch, \n>  and not all branches, (i.e. it's currently showing \"13 days ago\" for \n>  cinelerra-pmdumuid, whilst if you click the summary, you'll see I \n>  actually extended one of the branches only \"24 hours ago\".\n\nThis feature is planned (even if I forgot to mention it in the latest\n\"[RFC] gitweb wishlist and TODO list\"[*1*] thread), but for performance\nreasons it waits for git-for-each-ref to be in released version of git, as\nit should be used for projects list to not be generated too slow.\n\nBut we could add it (although git is now in freezer before 1.4.3 release).\nI was thinking about using \n  $feature{'lastchange'}{'default'} = HEAD | <branchname> | undef\nwhere undef means search all branches for latest commit.\n\n>  2nd feature request it the ability to browse to the next / previous \n>  commit when looking at a commitdiff...\n \nFirst, merges can have more than one parent, so \"previous\" (or rather\n\"parent\") can be ambiguous. Well, we could use first parent... But even\nnow it is fairly easy to go to the parent commitdiff: click on \"commit\"\nlink in the top navigation bar, or on the subject of commit; then click\non the \"parent\" link in the commit view; then click on \"commitdiff\" link\nin the top navigation bar, or on the subject of commit.\n\nGit philosophy and design precludes any kind of \"next\" link. Commit object\nhas only links to parents, never to children. If one really, really need\n\"next\" link, one would need to save branch and where on branch we are\n(in the git-name-rev way, e.g. b=HEAD~10) and pray somebody didn't update\nthe branch.\n\nIt should be quite easy to add commit+commitdiff view, though.\n\n[*1*] http://marc.theaimsgroup.com/?t=115082282700003&r=1&w=2\n      Msg-Id: <egdge3$t12$1@sea.gmane.org>\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}