All of lore.kernel.org
 help / color / mirror / Atom feed
* git-shortlog script
@ 2005-06-04 22:33 Jeff Garzik
  2005-06-04 23:45 ` Linus Torvalds
  0 siblings, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2005-06-04 22:33 UTC (permalink / raw)
  To: Git Mailing List, Linux Kernel; +Cc: Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]


Attached is the 'git-shortlog' script I whipped up, to mimic the 
shortlog script that was used back in the BitKeeper days.

shortlog reads a changelog in the 'git-whatchanged' format, such as

	git-whatchanged | git-shortlog
		or
	git-shortlog changes.txt

and outputs the changes sorted by author:

	author1:
	  cset 1-line desc
	  cset 1-line desc
	  ...
	author2:
	  cset 1-line desc
	  ...
	...

Since git distinguishes 'author' from 'committer', I ran

	git-whatchanged | git-shortlog > changes.txt

to look at the kernel authors throughout the entire history [of which is 
in git].

It's fun to browse, since this is the first time we've been able to get 
a better picture who is actually writing the patches, versus committing 
them.  See changes.txt.bz2, attached.

	Jeff




[-- Attachment #2: git-shortlog --]
[-- Type: text/plain, Size: 1125 bytes --]

#!/usr/bin/perl -w

use strict;

my ($author, $desc, %map);
my $pstate = 1;

while (<>) {
	# get author
	if ($pstate == 1) {
		next unless /^Author: (.*)$/;
		$author = $1;
		$pstate++;
	}

	# skip to blank line
	elsif ($pstate == 2) {
		next unless /^\s*$/;
		$pstate++;
	}

	# skip to non-blank line
	elsif ($pstate == 3) {
		next if /^\s*$/;
		chomp;
		$desc = $_;

		&shortlog_entry($author, $desc);

		$pstate = 1;
	}

	else {
		die "invalid parse state $pstate";
	}
}

&shortlog_output;
exit(0);


sub shortlog_entry($$) {
	my ($tmp_author, $tmp_desc) = @_;

	$tmp_desc =~ s#/pub/scm/linux/kernel/git/#/.../#g;
	$tmp_desc =~ s#\[PATCH\] ##g;
	$tmp_desc =~ s#^\s+##g;

	if (exists $map{$tmp_author}) {
		# grab ref
		my $obj = $map{$tmp_author};

		# add desc to array
		push(@$obj, $tmp_desc);
	} else {
		# create new array, containing 1 item
		my @arr = ($tmp_desc);

		# store ref to array
		$map{$tmp_author} = \@arr;
	}
}

sub shortlog_output {
	my ($obj);

	foreach $author (sort keys %map) {
		print "$author:\n";

		$obj = $map{$author};
		foreach $desc (@$obj) {
			print "  $desc\n";
		}

		print "\n";
	}
}


[-- Attachment #3: changes.txt.bz2 --]
[-- Type: application/x-bzip2, Size: 31825 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-shortlog script
  2005-06-04 22:33 git-shortlog script Jeff Garzik
@ 2005-06-04 23:45 ` Linus Torvalds
  2005-06-04 23:47   ` Linus Torvalds
  2005-06-05  0:08   ` Jeff Garzik
  0 siblings, 2 replies; 6+ messages in thread
From: Linus Torvalds @ 2005-06-04 23:45 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Git Mailing List, Linux Kernel



On Sat, 4 Jun 2005, Jeff Garzik wrote:
> 
> Attached is the 'git-shortlog' script I whipped up, to mimic the 
> shortlog script that was used back in the BitKeeper days.

Thanks, I'll add this to the git stuff, and next kernel release will have 
a proper shortlog.

Btw, it shows how broken your merge script is: you don't fill in the 
AUTHOR field properly for some reason:

 <jgarzik@pretzel.yyz.us>:
  Automatic merge of /spare/repo/netdev-2.6 branch r8169-fix
  Automatic merge of /spare/repo/linux-2.6/.git branch HEAD
  Automatic merge of /spare/repo/netdev-2.6 branch use-after-unmap
  Automatic merge of rsync://rsync.kernel.org/.../torvalds/linux-2.6.git branch HEAD

but "committer" is right. Pls fix.

		Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-shortlog script
  2005-06-04 23:45 ` Linus Torvalds
@ 2005-06-04 23:47   ` Linus Torvalds
  2005-06-05  0:08   ` Jeff Garzik
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2005-06-04 23:47 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Git Mailing List, Linux Kernel



On Sat, 4 Jun 2005, Linus Torvalds wrote:
> 
> Btw, it shows how broken your merge script is: you don't fill in the 
> AUTHOR field properly for some reason:

Oh, and the reason you didn't notice is that "git-whatchanged" normally 
ignores merges. Do 

	git-rev-list --pretty HEAD ^v2.6.12-rc5 | git-shortlog | less -S

to see what I'm talking about ("show shortlog of all the changes since
v2.6.12-rc5").

		Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-shortlog script
  2005-06-04 23:45 ` Linus Torvalds
  2005-06-04 23:47   ` Linus Torvalds
@ 2005-06-05  0:08   ` Jeff Garzik
  2005-06-05  0:16     ` Linus Torvalds
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Garzik @ 2005-06-05  0:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List, Linux Kernel

Linus Torvalds wrote:
> 
> On Sat, 4 Jun 2005, Jeff Garzik wrote:
> 
>>Attached is the 'git-shortlog' script I whipped up, to mimic the 
>>shortlog script that was used back in the BitKeeper days.
> 
> 
> Thanks, I'll add this to the git stuff, and next kernel release will have 
> a proper shortlog.

cool


> Btw, it shows how broken your merge script is: you don't fill in the 
> AUTHOR field properly for some reason:
> 
>  <jgarzik@pretzel.yyz.us>:
>   Automatic merge of /spare/repo/netdev-2.6 branch r8169-fix
>   Automatic merge of /spare/repo/linux-2.6/.git branch HEAD
>   Automatic merge of /spare/repo/netdev-2.6 branch use-after-unmap
>   Automatic merge of rsync://rsync.kernel.org/.../torvalds/linux-2.6.git branch HEAD
> 
> but "committer" is right. Pls fix.

hehe, my merge script is Ctrl-R (recall last git-resolve-script invocation).

Committer is right because I set that in my .bash_profile.  I'll do that 
for author too, to provide a sane default.

I'm surprised git doesn't fall back to GIT_COMMITTER_NAME if 
GIT_AUTHOR_NAME doesn't exist, though.

	Jeff



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-shortlog script
  2005-06-05  0:08   ` Jeff Garzik
@ 2005-06-05  0:16     ` Linus Torvalds
  2005-06-05  0:19       ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Torvalds @ 2005-06-05  0:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Git Mailing List, Linux Kernel



On Sat, 4 Jun 2005, Jeff Garzik wrote:
> 
> I'm surprised git doesn't fall back to GIT_COMMITTER_NAME if 
> GIT_AUTHOR_NAME doesn't exist, though.

GIT_AUTHOR_NAME existed first ;)

Btw, what does your /etc/passwd look like, and I'll try to hack it up to 
just get that case right by default too..

		Linus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git-shortlog script
  2005-06-05  0:16     ` Linus Torvalds
@ 2005-06-05  0:19       ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2005-06-05  0:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List, Linux Kernel

Linus Torvalds wrote:
> 
> On Sat, 4 Jun 2005, Jeff Garzik wrote:
> 
>>I'm surprised git doesn't fall back to GIT_COMMITTER_NAME if 
>>GIT_AUTHOR_NAME doesn't exist, though.
> 
> 
> GIT_AUTHOR_NAME existed first ;)
> 
> Btw, what does your /etc/passwd look like, and I'll try to hack it up to 
> just get that case right by default too..

ah, it looks like I forget the name when I was creating the account.

> [jgarzik@pretzel libata-dev]$ grep jgarzik /etc/passwd
> jgarzik:x:500:500::/g/g:/bin/bash

> [jgarzik@pretzel libata-dev]$ chfn
> Changing finger information for jgarzik.
> Password: 
> Name []: Jeff Garzik
> Office []: 
> Office Phone []: 
> Home Phone []: 
> 
> Finger information changed.

Fixed.  :)

In any case, I'll set GIT_AUTHOR_NAME in .bash_profile, to get my proper 
email addy rather than the local one.

	Jeff



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-05  0:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-04 22:33 git-shortlog script Jeff Garzik
2005-06-04 23:45 ` Linus Torvalds
2005-06-04 23:47   ` Linus Torvalds
2005-06-05  0:08   ` Jeff Garzik
2005-06-05  0:16     ` Linus Torvalds
2005-06-05  0:19       ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.