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

Re: git: detect file creator

From
STSim Tov <smntov@gmail.com>
Date
Jul 16, 2022, 21:38 UTC
Message-ID
<CA+X_a+zbG_CDP6D0zxozRoUmBeWm4dVxQ=xYRqFeWrk+FR5p0g@mail.gmail.com>
In-Reply-To
<220715.86fsj2zeqn.gmgdl@evledraar.gmail.com>
Thank you very much, again, for the very useful suggestions!
Show 6 quoted lines
> > 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...
I added `--diff-filter=AR` to my original command like this:

git log --use-mailmap --no-merges --diff-filter=AR --author="CertainEditor" --name-only --pretty=format:""

and it seems to do the job! May I have missed/messed something here?
Show 7 quoted lines
> > 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.

2.1. Will such iteration over history not more time consuming compared to my command? 2.2. Will it not account for useless "diff"s, like add some rubbish, delete that rubbish - and I'll have to pay for it...

Show 7 quoted lines
> > 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.

I pay per character, so you probably mean `wc -m`... but what do you mean by changed files? The command above is part of a script I run all the time I want to measure each editors' char count... it might be even without any specific recent changes...

Show 8 quoted lines
> > 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...
Good point :-) I will not do it.
Previous: Ævar Arnfjörð BjarmasonNext: Sim Tov
Message 3 of 6 in “git: detect file creator”
  1. Sim TovJul 15, 2022
  2. Ævar Arnfjörð BjarmasonJul 15, 2022
  3. Sim TovJul 16, 2022
  4. Sim TovJul 18, 2022
  5. Sim TovJul 18, 2022
  6. Junio C HamanoJul 22, 2022

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.