git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Git List <git@vger.kernel.org>
Subject: Re: Method for Calculating Statistics of Developer Contribution to a Specified Branch.
Date: Tue, 31 Oct 2023 13:09:55 +0800	[thread overview]
Message-ID: <CAGP6POK2yABRhJHQYfOFZ2h6BSy9XU6aZbnBaA11TJiEnBAa6g@mail.gmail.com> (raw)
In-Reply-To: <ZUAk6dPJyhfb7UBM@nand.local>

On Tue, Oct 31, 2023 at 5:49 AM Taylor Blau <me@ttaylorr.com> wrote:
>
> On Tue, Oct 17, 2023 at 07:37:46PM +0800, Hongyi Zhao wrote:
> > I want to calculate a certain developer's contribution based on
> > different standards of code line count and the importance of the code.
>
> I agree with brian that "number of lines added/removed" is not a perfect
> measure of productivity ;-).
>
> But I think that there is a slightly cleaner way to compute the result
> you're after, like so:
>
>     git rev-list --author="$who" origin/main |
>     git diff-tree --stdin -r --numstat --no-commit-id |
>     awk '{ s += $1 + $2 } END { print s }'

See below:

werner@X10DAi:~/Public/repo/github.com/OrderN/CONQUEST-release.git$
git log --author="JianboLin" --stat --summary origin/f-mlff | awk 'NF
==4 && $2 =="|" && $3 ~/[0-9]+/ && $4 ~/[+-]+|[+]+|[-]+/ {s+=$3} END
{print s}'
8519
werner@X10DAi:~/Public/repo/github.com/OrderN/CONQUEST-release.git$
git rev-list --author="JianboLin" origin/f-mlff |     git diff-tree
--stdin -r --numstat --no-commit-id |     awk '{ s += $1 + $2 } END {
print s }'
8519

So, your method and my original one give exactly the same result.
Therefore, I can't see what their fundamental difference is.

> Thanks,
> Taylor

Regards,
Zhao

  reply	other threads:[~2023-10-31  5:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 14:10 Method for Calculating Statistics of Developer Contribution to a Specified Branch Hongyi Zhao
2023-10-16 21:25 ` brian m. carlson
2023-10-17 11:37   ` Hongyi Zhao
2023-10-30 21:49     ` Taylor Blau
2023-10-31  5:09       ` Hongyi Zhao [this message]
2023-10-31  6:25         ` Junio C Hamano
2023-10-31 19:05           ` Taylor Blau

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=CAGP6POK2yABRhJHQYfOFZ2h6BSy9XU6aZbnBaA11TJiEnBAa6g@mail.gmail.com \
    --to=hongyi.zhao@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=sandals@crustytoothpaste.net \
    /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).