git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: git <git@vger.kernel.org>
Subject: Re: How to efficiently blame an entire repo?
Date: Fri, 30 Apr 2010 16:16:13 -0400	[thread overview]
Message-ID: <o2m76718491004301316tfbaf434alb94e6bfd001d36b6@mail.gmail.com> (raw)
In-Reply-To: <x2s32541b131004301245o46d8e855va0b51ebce279398b@mail.gmail.com>

On Fri, Apr 30, 2010 at 3:45 PM, Avery Pennarun <apenwarr@gmail.com> wrote:
> On Thu, Apr 29, 2010 at 7:12 PM, Jay Soffian <jaysoffian@gmail.com> wrote:
>> Let's say you've got a repo with ~ 40K files and 35K commits.
>> Well-packed .git is about 800MB.
>>
>> You want to find out how many lines of code a particular group of
>> individuals has contributed to HEAD.
>>[...]
>> Am I missing a clever solution?
>
> How often do you need to do this?  If it's just once in your life,
> then the brute force solution of just letting 'git blame' grind
> through it for a few hours is probably the cleverest :)

Yeah, I ended up doing this basically.

Setup a .mailmap mapping the authors I was interested in to domain.com. Then:

$ git log --pretty='%H %aE' HEAD | grep domain.com |
  awk '{print $1}' |
  git log --no-walk --stdin --name-only --pretty=%n |
  grep -v '^$' | sort -u > files1
$ git ls-files | sort > files2
$ comm -12 files1 files2 > files
$ xargs < files -n1 git annotate | grep domain.com

I didn't use --author=domain.com w/the first log invocation because I
wasn't sure if it respected .mailmap and was too lazy to look it up.

I probably I could've used --diff-filter in the second log invocation, but, meh.

So that worked. Took about 12 minutes to run on a recent Macbook Pro.
Aside, blame's --porcelain switch is rather poorly documented and
annotate seemed to have the right output for the job.

j.

  reply	other threads:[~2010-04-30 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-29 23:12 How to efficiently blame an entire repo? Jay Soffian
2010-04-30 19:45 ` Avery Pennarun
2010-04-30 20:16   ` Jay Soffian [this message]
2010-04-30 21:21 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=o2m76718491004301316tfbaf434alb94e6bfd001d36b6@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).