* git-who @ 2008-10-07 21:02 Rhodes, Kate 2008-10-07 22:35 ` git-who Miklos Vajna ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Rhodes, Kate @ 2008-10-07 21:02 UTC (permalink / raw) To: git Once upon a someone asked about seeing who had touched some files. Petr Baudis responded with a quickie script that did the job. I've since expanded upon it a little, and since I find it pretty useful, I figured I'd send it back for others to use too. As is it's probably not worth including in git, but I'm thinking that someone else can probably come up with some improvements, such as dates in the verbose mode, support for a treeish instead of a single file path, and / or rewriting it in C so that it can work on Windows. http://github.com/masukomi/git_accessories/tree/master git://github.com/masukomi/git_accessories.git Not that it's particularly worthy of it's own repo at the moment, but I figure I'll continue to keep poking it from time to time... -masukomi ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-07 21:02 git-who Rhodes, Kate @ 2008-10-07 22:35 ` Miklos Vajna 2008-10-08 2:25 ` git-who Jeff King 2008-10-08 6:13 ` git-who Johannes Sixt 2 siblings, 0 replies; 7+ messages in thread From: Miklos Vajna @ 2008-10-07 22:35 UTC (permalink / raw) To: Rhodes, Kate; +Cc: git [-- Attachment #1: Type: text/plain, Size: 395 bytes --] On Tue, Oct 07, 2008 at 05:02:46PM -0400, "Rhodes, Kate" <masukomi@gmail.com> wrote: > the verbose mode, support for a treeish instead of a single file path, and > / or rewriting it in C so that it can work on Windows. I thought - based on this - that it's written in ruby or something, but it's just shell and perl, so probably it works in Windows as well without any kind of rewrite. [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-07 21:02 git-who Rhodes, Kate 2008-10-07 22:35 ` git-who Miklos Vajna @ 2008-10-08 2:25 ` Jeff King 2008-10-08 4:59 ` git-who Rhodes, Kate 2008-10-08 6:13 ` git-who Johannes Sixt 2 siblings, 1 reply; 7+ messages in thread From: Jeff King @ 2008-10-08 2:25 UTC (permalink / raw) To: Rhodes, Kate; +Cc: git On Tue, Oct 07, 2008 at 05:02:46PM -0400, Kate Rhodes wrote: > As is it's probably not worth including in git, but I'm thinking that > someone else can probably come up with some improvements, such as dates in > the verbose mode, support for a treeish instead of a single file path, and > / or rewriting it in C so that it can work on Windows. Scripts like this often find a good home in git's contrib/ directory. Consider submitting a patch which adds it there. > git://github.com/masukomi/git_accessories.git I took a look. My biggest complaint is that for many files, it produces too many names. It would be nice to at least sort the names by number of commits. But even more accurate might be the number of added lines. Somebody who creates a 200-line file should surely come before somebody who made a 1-line tweak, right? But perhaps even more accurate would be to rely on blame output, since it attributes not just added lines, but lines which have actually survived into the current product. And fortunately that is relatively easy to do (only lightly tested): -- >8 -- #!/usr/bin/perl # # Invoke as 'git who -M -C file.c' (or whichever blame options # you prefer). You can even check a particular set of lines # with "git who -M -C -L 40,60 file.c". use strict; open(my $in, '-|', qw(git blame -p), @ARGV); my %count; my %author; my $current_sha1; while(<$in>) { if (!$current_sha1) { /^[0-9a-f]{40}/ or die "expected sha1, got $_"; $current_sha1 = $&; $count{$current_sha1}++; } elsif (/^author (.*)/) { $author{$current_sha1} = $1; } elsif (/^\t/) { $current_sha1 = undef; } } my %acount; while(my ($h, $c) = each %count) { $acount{$author{$h}} += $c; } foreach (sort { $acount{$b} <=> $acount{$a} } keys %acount) { print "$_ ($acount{$_})\n"; } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-08 2:25 ` git-who Jeff King @ 2008-10-08 4:59 ` Rhodes, Kate 0 siblings, 0 replies; 7+ messages in thread From: Rhodes, Kate @ 2008-10-08 4:59 UTC (permalink / raw) To: Jeff King; +Cc: git On Oct 7, 2008, at 10:25 PM, Jeff King wrote: > On Tue, Oct 07, 2008 at 05:02:46PM -0400, Kate Rhodes wrote: > >> As is it's probably not worth including in git, but I'm thinking that >> someone else can probably come up with some improvements, such as >> dates in >> the verbose mode, support for a treeish instead of a single file >> path, and >> / or rewriting it in C so that it can work on Windows. > > Scripts like this often find a good home in git's contrib/ directory. > Consider submitting a patch which adds it there. > >> git://github.com/masukomi/git_accessories.git > > I took a look. My biggest complaint is that for many files, it > produces > too many names. Yeah, I agree, I just haven't come up with a better idea that addresses the question of "who touched this". Maybe some sort of recency toggle. > It would be nice to at least sort the names by number > of commits. But even more accurate might be the number of added lines. > Somebody who creates a 200-line file should surely come before > somebody > who made a 1-line tweak, right? Yeah, I've considered maybe adding a -n (number) like that and ordering people by number of commits. I'm not convinced that, in most cases, size of changes is as important as number. I think it depends on the file. In some cases a person who's constantly mucking about with the file is a better go-to person when you have questions / issues, than someone who happened to make a few large commits a while ago. But then again.... > > But perhaps even more accurate would be to rely on blame output, since > it attributes not just added lines, but lines which have actually > survived into the current product. mmm good idea. > And fortunately that is relatively > easy to do (only lightly tested): excellent! Thank you. I'll poke at this tomorrow. :) -masukomi > > > -- >8 -- > #!/usr/bin/perl > # > # Invoke as 'git who -M -C file.c' (or whichever blame options > # you prefer). You can even check a particular set of lines > # with "git who -M -C -L 40,60 file.c". > > use strict; > > open(my $in, '-|', qw(git blame -p), @ARGV); > > my %count; > my %author; > my $current_sha1; > while(<$in>) { > if (!$current_sha1) { > /^[0-9a-f]{40}/ or die "expected sha1, got $_"; > $current_sha1 = $&; > $count{$current_sha1}++; > } > elsif (/^author (.*)/) { > $author{$current_sha1} = $1; > } > elsif (/^\t/) { > $current_sha1 = undef; > } > } > > my %acount; > while(my ($h, $c) = each %count) { > $acount{$author{$h}} += $c; > } > > foreach (sort { $acount{$b} <=> $acount{$a} } keys %acount) { > print "$_ ($acount{$_})\n"; > } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-07 21:02 git-who Rhodes, Kate 2008-10-07 22:35 ` git-who Miklos Vajna 2008-10-08 2:25 ` git-who Jeff King @ 2008-10-08 6:13 ` Johannes Sixt 2008-10-08 13:48 ` git-who Rhodes, Kate 2008-10-08 18:35 ` git-who Linus Torvalds 2 siblings, 2 replies; 7+ messages in thread From: Johannes Sixt @ 2008-10-08 6:13 UTC (permalink / raw) To: Rhodes, Kate; +Cc: git Rhodes, Kate schrieb: > Once upon a someone asked about seeing who had touched some files. Petr > Baudis responded with a quickie script that did the job. Wouldn't git shortlog -s -- path/to/file solve your problem? -- Hannes ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-08 6:13 ` git-who Johannes Sixt @ 2008-10-08 13:48 ` Rhodes, Kate 2008-10-08 18:35 ` git-who Linus Torvalds 1 sibling, 0 replies; 7+ messages in thread From: Rhodes, Kate @ 2008-10-08 13:48 UTC (permalink / raw) To: Johannes Sixt; +Cc: git No. No, that's far too simple. ;) -Kate On Oct 8, 2008, at 2:13 AM, Johannes Sixt wrote: > Rhodes, Kate schrieb: >> Once upon a someone asked about seeing who had touched some files. >> Petr >> Baudis responded with a quickie script that did the job. > > Wouldn't > > git shortlog -s -- path/to/file > > solve your problem? > > -- Hannes > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-who 2008-10-08 6:13 ` git-who Johannes Sixt 2008-10-08 13:48 ` git-who Rhodes, Kate @ 2008-10-08 18:35 ` Linus Torvalds 1 sibling, 0 replies; 7+ messages in thread From: Linus Torvalds @ 2008-10-08 18:35 UTC (permalink / raw) To: Johannes Sixt; +Cc: Rhodes, Kate, Git Mailing List On Wed, 8 Oct 2008, Johannes Sixt wrote: > > Wouldn't > > git shortlog -s -- path/to/file I suspect "-sn" is better. It sorts by number rather than by name, and if you're interested in who has touched a file, you probably wants to know who has touched it _most_. And as usual, the nice thing about it is that all the normal git rules apply, so you can do it by multiple files or subdirectories, and you can filter by time. And ignore merges, since they tend to be about upper-level maintainers than about the people doing patches. So for the kernel, you can do something like git shortlog -ns --no-merges --since=6.months.ago drivers/scsi include/scsi and see who has been doing scsi-related stuff lately. Of course, when it comes to relevance, it may be more interesting to just look at 'git blame' output, and then you're limited to single files at a time. And performance is going to be a problem, especially if you enable movement detection. But we don't have anything special for that. You can do it with something like git blame -M -w kernel/sched.c | grep -v '^^' | cut -d'(' -f2- | cut -c1-20 | sort | uniq -c | sort -n which will ignore the root commit (so as not to give me all the credit for old history), but it would probably be better (but more complex - need perl or some other "real" language with associative arrays etc to remember the commit information) to parse the output of "git blame --incremental" instead. Linus ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-08 18:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-10-07 21:02 git-who Rhodes, Kate 2008-10-07 22:35 ` git-who Miklos Vajna 2008-10-08 2:25 ` git-who Jeff King 2008-10-08 4:59 ` git-who Rhodes, Kate 2008-10-08 6:13 ` git-who Johannes Sixt 2008-10-08 13:48 ` git-who Rhodes, Kate 2008-10-08 18:35 ` git-who Linus Torvalds
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).