git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Sim Tov <smntov@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git: detect file creator
Date: Fri, 15 Jul 2022 15:22:23 +0200	[thread overview]
Message-ID: <220715.86fsj2zeqn.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CA+X_a+ycefqvz0LaO0KK1LuTqgE=iUhooPRXeo3mq-zXkp+nCA@mail.gmail.com>


On Fri, Jul 15 2022, Sim Tov wrote:

> Hello,
>
> I run a book digitizing project and pay people certain rate per 10K
> characters for the text files they upload to a git repo. Till now I

It's nice to see that someone still believes in The Mythical Man- Month
:)

> was using following command to detect files authored by CertainEditor:
>
>     git log --use-mailmap --no-merges --author="CertainEditor"
> --name-only --pretty=format:""
>
> Then I would pipe this output in `wc -m` and get amount of characters
> authored by CertainEditor and pay him accordingly. Usually editors do
> not touch each other's files and everything worked well. However
> recently one editor spotted a typo in somebody else's file and
> corrected it. This behavior is actually good and I would like to
> encourage it. However, now the command above lists the corrected file
> also as his, and so he gets paid for all the characters in the file
> while he changed only one of them. This, obviously, is not good.
>
> 1. Do you have an idea how can I list all the files **created** (not
> authored / committed) by a user, so I can implement a fair characters
> counting?

If you want to adapt your current script perhaps --diff-filter helps,
but...

> 2. Maybe some commit hooks can be used that will check whether the
> Author of a new commit is different from the previous one and if true
> - override it to the previous Author?

..it seems you should fundamentally stop using it, and instead iterate
over the commits, and pay for a "diff". Then you'd get the original
change, as well as the change-on-top.

> 3. Those small changes by a non-creator may be left not paid for (as
> this action is not so intensive and may be reciprocal), but if you
> have a good idea how I can pay for the "diff" the non-creator provides
> - it would be nice!

Just wc -l on the changed files(s) before & after, and pay the abs()
difference.

> Do you think this "diff" should be deducted from the creator? And if
> yes - how?

You could walk it back with "git blame" I guess.

But you might want to consider the economic & social mis-incentives of
lifting money from your co-workers coffers by pointing out a mistake to
them...


  reply	other threads:[~2022-07-15 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 12:39 git: detect file creator Sim Tov
2022-07-15 13:22 ` Ævar Arnfjörð Bjarmason [this message]
2022-07-16 21:38   ` Sim Tov
2022-07-18 20:12     ` Sim Tov
2022-07-18 20:40       ` Sim Tov
2022-07-22  6:11         ` Junio C Hamano

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=220715.86fsj2zeqn.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=smntov@gmail.com \
    /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).