All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Lyaudet <laurent.lyaudet@gmail.com>
To: git@vger.kernel.org
Subject: Re: Git has two ways to count modified lines
Date: Sat, 2 Apr 2022 18:49:00 +0200	[thread overview]
Message-ID: <CAB1LBms3F1EGswxF9mO=JrmWmj4XFncv4ZrkAy-dvOHdVrkwLQ@mail.gmail.com> (raw)
In-Reply-To: <CAB1LBmvX4kv3yqSZ+X4Ozkb9esUem3U1JY48kWVi_Eef78Sk=Q@mail.gmail.com>

Le mer. 16 mars 2022 à 19:08, Laurent Lyaudet
<laurent.lyaudet@gmail.com> a écrit :
>
> Hello,
>
> I check the number of lines modified by my commits by hand,
> and today I had a surprising count :
>
> 1) I commit and get the following count
> laurent@laurent-GL73-8SD:~/ReposGit/flow$ git commit
> [master c068911] Task CU-21ph8h7 add buttons in PresenceList: "Tout
> déplier", "Tout replier", for this the useState for showDetail
> (boolean) in Presence is replaced by a useState for showDetails (Set
> of ids) in PresenceList; correction missing tr between thead and ths
> in PresenceList.
>  2 files changed, 88 insertions(+), 48 deletions(-)
>  rewrite src/apps/logs/components/PresenceList.js (61%)
>
> 2) I check the diff by hand, it doesn't match.
> I check on github, it agrees with my manual count.
>
> 3) I try to get the same answer again in command-line.
> laurent@laurent-GL73-8SD:~/ReposGit/flow$ git log -1 --shortstat
> commit c068911547bddbf7bfc4ddc7a68ee8482421ed5c (HEAD -> master,
> origin/master, origin/HEAD)
> Author: Laurent Lyaudet <laurent.lyaudet@gmail.com>
> Date:   Wed Mar 16 18:40:25 2022 +0100    Task CU-21ph8h7 add buttons
> in PresenceList: "Tout déplier", "Tout replier",
>     for this the useState for showDetail (boolean) in Presence is replaced
>     by a useState for showDetails (Set of ids) in PresenceList;
>     correction missing tr between thead and ths in PresenceList. 2
> files changed, 71 insertions(+), 31 deletions(-)
>
> How comes git has two ways to count modified lines ?
> How can I make git output again the same numbers than just after commit ?
> How can I check how it computed these numbers in the first place ?
>
> Thanks, best regards,
>     Laurent Lyaudet

Hello,

I thought my email was sent to the right mailbox, at least it is what
says this website :
https://git-scm.com/community
> General questions or comments for the Git community can be sent to the mailing list by using the email address git@vger.kernel.org.
Moreover this website is cited in the README here :
https://github.com/git/git/blob/master/README.md
> Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.
Is there any problem with my questions explaining I got no answer, please ?

I have found a partial explanation for the count differences :
>  2 files changed, 88 insertions(+), 48 deletions(-)
>  rewrite src/apps/logs/components/PresenceList.js (61%)
When committing, a file considered as "rewrite" is counted like m
lines deleted and n lines added if it had m lines before and n lines
after.
Even if the diff is much smaller.
Hence I answered my question :
> How can I check how it computed these numbers in the first place ?
But the two other questions remains :
> How comes git has two ways to count modified lines ?
i.e. What is (was) the purpose of this rewrite counting (when coded) ?
> How can I make git output again the same numbers than just after commit ?

Thanks, best regards,
    Laurent Lyaudet

  reply	other threads:[~2022-04-02 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 18:08 Git has two ways to count modified lines Laurent Lyaudet
2022-04-02 16:49 ` Laurent Lyaudet [this message]
2022-04-02 21:55   ` René Scharfe
     [not found]     ` <xmqqh779u72a.fsf@gitster.g>
2022-04-04 21:08       ` René Scharfe
2022-04-05  1:58         ` Ævar Arnfjörð Bjarmason
2022-04-05 15:57           ` René Scharfe
2022-04-05 15:57     ` Laurent Lyaudet

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='CAB1LBms3F1EGswxF9mO=JrmWmj4XFncv4ZrkAy-dvOHdVrkwLQ@mail.gmail.com' \
    --to=laurent.lyaudet@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.