git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-who

From
RKRhodes, Kate <masukomi@gmail.com>
Date
Oct 8, 2008, 04:59 UTC
Message-ID
<70ED45EF-54B8-42D9-98BA-F2E98C786419@gmail.com>
In-Reply-To
<20081008022505.GB29313@coredump.intra.peff.net>
On Oct 7, 2008, at 10:25 PM, Jeff King wrote:
Show 17 quoted lines
> 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.

Show 5 quoted lines
> 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
Show 38 quoted lines
>
>
> -- >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";
> }
Previous: Jeff KingNext: Johannes Sixt
Message 4 of 7 in “git-who”
  1. Rhodes, KateOct 7, 2008
  2. Miklos VajnaOct 7, 2008
  3. Jeff KingOct 8, 2008
  4. Rhodes, KateOct 8, 2008
  5. Johannes SixtOct 8, 2008
  6. Rhodes, KateOct 8, 2008
  7. Linus TorvaldsOct 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.