{"thread":{"id":"834","subject":"git-shortlog script","startedAt":"2005-06-04T22:33:04Z","lastAt":"2005-06-05T00:19:47Z","messageCount":6,"participants":["Jeff Garzik","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"4556","messageId":"42A22C20.10002@pobox.com","threadId":"834","inReplyTo":null,"subject":"git-shortlog script","fromName":"Jeff Garzik","fromEmail":"jgarzik@pobox.com","sentAt":"2005-06-04T22:33:04Z","receivedAt":"2005-06-04T22:33:04Z","isPatch":false,"sender":{"key":"jgarzik@pobox.com","avatar":null},"body":"\nAttached is the 'git-shortlog' script I whipped up, to mimic the \nshortlog script that was used back in the BitKeeper days.\n\nshortlog reads a changelog in the 'git-whatchanged' format, such as\n\n\tgit-whatchanged | git-shortlog\n\t\tor\n\tgit-shortlog changes.txt\n\nand outputs the changes sorted by author:\n\n\tauthor1:\n\t  cset 1-line desc\n\t  cset 1-line desc\n\t  ...\n\tauthor2:\n\t  cset 1-line desc\n\t  ...\n\t...\n\nSince git distinguishes 'author' from 'committer', I ran\n\n\tgit-whatchanged | git-shortlog > changes.txt\n\nto look at the kernel authors throughout the entire history [of which is \nin git].\n\nIt's fun to browse, since this is the first time we've been able to get \na better picture who is actually writing the patches, versus committing \nthem.  See changes.txt.bz2, attached.\n\n\tJeff\n\n\n\n\n\n#!/usr/bin/perl -w\n\nuse strict;\n\nmy ($author, $desc, %map);\nmy $pstate = 1;\n\nwhile (<>) {\n\t# get author\n\tif ($pstate == 1) {\n\t\tnext unless /^Author: (.*)$/;\n\t\t$author = $1;\n\t\t$pstate++;\n\t}\n\n\t# skip to blank line\n\telsif ($pstate == 2) {\n\t\tnext unless /^\\s*$/;\n\t\t$pstate++;\n\t}\n\n\t# skip to non-blank line\n\telsif ($pstate == 3) {\n\t\tnext if /^\\s*$/;\n\t\tchomp;\n\t\t$desc = $_;\n\n\t\t&shortlog_entry($author, $desc);\n\n\t\t$pstate = 1;\n\t}\n\n\telse {\n\t\tdie \"invalid parse state $pstate\";\n\t}\n}\n\n&shortlog_output;\nexit(0);\n\n\nsub shortlog_entry($$) {\n\tmy ($tmp_author, $tmp_desc) = @_;\n\n\t$tmp_desc =~ s#/pub/scm/linux/kernel/git/#/.../#g;\n\t$tmp_desc =~ s#\\[PATCH\\] ##g;\n\t$tmp_desc =~ s#^\\s+##g;\n\n\tif (exists $map{$tmp_author}) {\n\t\t# grab ref\n\t\tmy $obj = $map{$tmp_author};\n\n\t\t# add desc to array\n\t\tpush(@$obj, $tmp_desc);\n\t} else {\n\t\t# create new array, containing 1 item\n\t\tmy @arr = ($tmp_desc);\n\n\t\t# store ref to array\n\t\t$map{$tmp_author} = \\@arr;\n\t}\n}\n\nsub shortlog_output {\n\tmy ($obj);\n\n\tforeach $author (sort keys %map) {\n\t\tprint \"$author:\\n\";\n\n\t\t$obj = $map{$author};\n\t\tforeach $desc (@$obj) {\n\t\t\tprint \"  $desc\\n\";\n\t\t}\n\n\t\tprint \"\\n\";\n\t}\n}\n\n"},{"id":"4557","messageId":"Pine.LNX.4.58.0506041642530.1876@ppc970.osdl.org","threadId":"834","inReplyTo":"42A22C20.10002@pobox.com","subject":"Re: git-shortlog script","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-04T23:45:10Z","receivedAt":"2005-06-04T23:45:10Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 4 Jun 2005, Jeff Garzik wrote:\n> \n> Attached is the 'git-shortlog' script I whipped up, to mimic the \n> shortlog script that was used back in the BitKeeper days.\n\nThanks, I'll add this to the git stuff, and next kernel release will have \na proper shortlog.\n\nBtw, it shows how broken your merge script is: you don't fill in the \nAUTHOR field properly for some reason:\n\n <jgarzik@pretzel.yyz.us>:\n  Automatic merge of /spare/repo/netdev-2.6 branch r8169-fix\n  Automatic merge of /spare/repo/linux-2.6/.git branch HEAD\n  Automatic merge of /spare/repo/netdev-2.6 branch use-after-unmap\n  Automatic merge of rsync://rsync.kernel.org/.../torvalds/linux-2.6.git branch HEAD\n\nbut \"committer\" is right. Pls fix.\n\n\t\tLinus\n"},{"id":"4558","messageId":"Pine.LNX.4.58.0506041645490.1876@ppc970.osdl.org","threadId":"834","inReplyTo":"Pine.LNX.4.58.0506041642530.1876@ppc970.osdl.org","subject":"Re: git-shortlog script","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-04T23:47:41Z","receivedAt":"2005-06-04T23:47:41Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 4 Jun 2005, Linus Torvalds wrote:\n> \n> Btw, it shows how broken your merge script is: you don't fill in the \n> AUTHOR field properly for some reason:\n\nOh, and the reason you didn't notice is that \"git-whatchanged\" normally \nignores merges. Do \n\n\tgit-rev-list --pretty HEAD ^v2.6.12-rc5 | git-shortlog | less -S\n\nto see what I'm talking about (\"show shortlog of all the changes since\nv2.6.12-rc5\").\n\n\t\tLinus\n"},{"id":"4559","messageId":"42A24274.7040906@pobox.com","threadId":"834","inReplyTo":"Pine.LNX.4.58.0506041642530.1876@ppc970.osdl.org","subject":"Re: git-shortlog script","fromName":"Jeff Garzik","fromEmail":"jgarzik@pobox.com","sentAt":"2005-06-05T00:08:20Z","receivedAt":"2005-06-05T00:08:20Z","isPatch":false,"sender":{"key":"jgarzik@pobox.com","avatar":null},"body":"Linus Torvalds wrote:\n> \n> On Sat, 4 Jun 2005, Jeff Garzik wrote:\n> \n>>Attached is the 'git-shortlog' script I whipped up, to mimic the \n>>shortlog script that was used back in the BitKeeper days.\n> \n> \n> Thanks, I'll add this to the git stuff, and next kernel release will have \n> a proper shortlog.\n\ncool\n\n\n> Btw, it shows how broken your merge script is: you don't fill in the \n> AUTHOR field properly for some reason:\n> \n>  <jgarzik@pretzel.yyz.us>:\n>   Automatic merge of /spare/repo/netdev-2.6 branch r8169-fix\n>   Automatic merge of /spare/repo/linux-2.6/.git branch HEAD\n>   Automatic merge of /spare/repo/netdev-2.6 branch use-after-unmap\n>   Automatic merge of rsync://rsync.kernel.org/.../torvalds/linux-2.6.git branch HEAD\n> \n> but \"committer\" is right. Pls fix.\n\nhehe, my merge script is Ctrl-R (recall last git-resolve-script invocation).\n\nCommitter is right because I set that in my .bash_profile.  I'll do that \nfor author too, to provide a sane default.\n\nI'm surprised git doesn't fall back to GIT_COMMITTER_NAME if \nGIT_AUTHOR_NAME doesn't exist, though.\n\n\tJeff\n\n\n"},{"id":"4560","messageId":"Pine.LNX.4.58.0506041715170.1876@ppc970.osdl.org","threadId":"834","inReplyTo":"42A24274.7040906@pobox.com","subject":"Re: git-shortlog script","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-06-05T00:16:46Z","receivedAt":"2005-06-05T00:16:46Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sat, 4 Jun 2005, Jeff Garzik wrote:\n> \n> I'm surprised git doesn't fall back to GIT_COMMITTER_NAME if \n> GIT_AUTHOR_NAME doesn't exist, though.\n\nGIT_AUTHOR_NAME existed first ;)\n\nBtw, what does your /etc/passwd look like, and I'll try to hack it up to \njust get that case right by default too..\n\n\t\tLinus\n"},{"id":"4561","messageId":"42A24523.5010404@pobox.com","threadId":"834","inReplyTo":"Pine.LNX.4.58.0506041715170.1876@ppc970.osdl.org","subject":"Re: git-shortlog script","fromName":"Jeff Garzik","fromEmail":"jgarzik@pobox.com","sentAt":"2005-06-05T00:19:47Z","receivedAt":"2005-06-05T00:19:47Z","isPatch":false,"sender":{"key":"jgarzik@pobox.com","avatar":null},"body":"Linus Torvalds wrote:\n> \n> On Sat, 4 Jun 2005, Jeff Garzik wrote:\n> \n>>I'm surprised git doesn't fall back to GIT_COMMITTER_NAME if \n>>GIT_AUTHOR_NAME doesn't exist, though.\n> \n> \n> GIT_AUTHOR_NAME existed first ;)\n> \n> Btw, what does your /etc/passwd look like, and I'll try to hack it up to \n> just get that case right by default too..\n\nah, it looks like I forget the name when I was creating the account.\n\n> [jgarzik@pretzel libata-dev]$ grep jgarzik /etc/passwd\n> jgarzik:x:500:500::/g/g:/bin/bash\n\n> [jgarzik@pretzel libata-dev]$ chfn\n> Changing finger information for jgarzik.\n> Password: \n> Name []: Jeff Garzik\n> Office []: \n> Office Phone []: \n> Home Phone []: \n> \n> Finger information changed.\n\nFixed.  :)\n\nIn any case, I'll set GIT_AUTHOR_NAME in .bash_profile, to get my proper \nemail addy rather than the local one.\n\n\tJeff\n\n\n"}]}