{"thread":{"id":"43393","subject":"Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier","startedAt":"2006-10-28T17:43:40Z","lastAt":"2006-10-28T20:57:59Z","messageCount":5,"participants":["Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"296234","messageId":"200610281943.40456.jnareb@gmail.com","threadId":"43393","inReplyTo":null,"subject":"[PATCH] gitweb: Move git_get_last_activity subroutine earlier","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-28T17:43:40Z","receivedAt":"2006-10-28T17:43:40Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nGood test for git-pickaxe (git-blame2).\n\n gitweb/gitweb.perl |   36 ++++++++++++++++++------------------\n 1 files changed, 18 insertions(+), 18 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5f6a562..cbab3c9 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -976,6 +976,24 @@ sub git_get_project_owner {\n \treturn $owner;\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 git_get_references {\n \tmy $type = shift || \"\";\n \tmy %refs;\n@@ -1082,24 +1100,6 @@ 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-- \n1.4.3.3\n"},{"id":"296232","messageId":"7vvem48dsr.fsf@assigned-by-dhcp.cox.net","threadId":"43393","inReplyTo":"200610281943.40456.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-28T19:01:56Z","receivedAt":"2006-10-28T19:01:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Why is this needed?\n"},{"id":"297629","messageId":"ei0ags$l1l$1@sea.gmane.org","threadId":"43393","inReplyTo":"7vvem48dsr.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-28T19:20:46Z","receivedAt":"2006-10-28T19:20:46Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Why is this needed?\n \nThis is purely cosmetic, and originally was to be first patch in series\nconverting git_summary, git_heads and git_tags to use of git-for-each-ref...\nbut unfortunately git-for-each-ref lacks sorting on taggerdate OR\ncommitterdate (i.e. use taggerdate if applicable, committerdate otherwise).\n\nI'd rather not have git_get_last_activity between two parse_* subroutines...\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"297398","messageId":"7v3b988cqn.fsf@assigned-by-dhcp.cox.net","threadId":"43393","inReplyTo":"ei0ags$l1l$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-28T19:24:48Z","receivedAt":"2006-10-28T19:24:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> Why is this needed?\n>  \n> This is purely cosmetic, and originally was to be first patch in series\n> converting git_summary, git_heads and git_tags to use of git-for-each-ref...\n> but unfortunately git-for-each-ref lacks sorting on taggerdate OR\n> committerdate (i.e. use taggerdate if applicable, committerdate otherwise).\n>\n> I'd rather not have git_get_last_activity between two parse_* subroutines...\n\nOk, will apply but the last line of your response _should_ have\nbeen in the proposed commit log message without being asked.\n\n"},{"id":"294603","messageId":"7v3b986tuw.fsf@assigned-by-dhcp.cox.net","threadId":"43393","inReplyTo":"200610281943.40456.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Move git_get_last_activity subroutine earlier","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-10-28T20:57:59Z","receivedAt":"2006-10-28T20:57:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> Good test for git-pickaxe (git-blame2).\n\n\"git pickaxe -M v1.4.3.. -- gitweb/gitweb.perl\" finds copies by\nyou just fine (It is interesting to compare it with output\nwithout -M), thanks.\n\n\n"}]}