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

Re: [git 2.26] stat counts reported by commit and log are different

From
Jeff King <peff@peff.net>
Date
Apr 9, 2020, 13:59 UTC
Message-ID
<20200409135959.GB3494212@coredump.intra.peff.net>
In-Reply-To
<CAM+g_Nv4UqQNAuYyo5zsTsiomCe4ueoM6ZGU1aqAjLGV9+jQJg@mail.gmail.com>
On Wed, Apr 08, 2020 at 07:04:02PM -0700, Norbert Kiesel wrote:
Show 5 quoted lines
> % git commit -m 'major code cleanup for SCIMPatchOperationUtil'
> [nkiesel/nextrelease/SCIM_2 d4db6f6d83f] major code cleanup for
> SCIMPatchOperationUtil
>  1 file changed, 2106 insertions(+), 3367 deletions(-)
>  rewrite utils/SCIMPatchOperationUtil.java (74%)

The commit summary diff is done with the break-detection option on. You can tell it kicked in here because of the "rewrite" line. What that means is that the changes to the file were so extensive that Git decided the file had been totally rewritten, and broke it into a separate add/delete. That has two implications:

  - we'd consider it a candidate for rename detection; that didn't
    happen here because there were no other files added or deleted to
    serve as source/dest candidates
  - the diff will be reported as a complete removal of the old content
    and the addition of the new, _even for lines that were the same_
Show 10 quoted lines
> % git log --stat -1
> commit d4db6f6d83f (HEAD -> nkiesel/nextrelease/SCIM_2)
> Author: Norbert Kiesel <nkiesel@metricstream.com>
> Date:   Wed Apr 8 18:49:27 2020 -0700
> 
>     major code cleanup for SCIMPatchOperationUtil
> 
>  utils/SCIMPatchOperationUtil.java | 3807
> +++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------
>  1 file changed, 1273 insertions(+), 2534 deletions(-)

But in git-log break-detection isn't on by default. Try adding "-B" and you will get the other numbers.

Try also adding "-p" to see the whole-diff in action.
-Peff
Previous: Norbert KieselNext: Norbert Kiesel
Message 2 of 6 in “[git 2.26] stat counts reported by commit and log are different”
  1. Norbert KieselApr 9, 2020
  2. Jeff KingApr 9, 2020
  3. Norbert KieselApr 9, 2020
  4. Jeff KingApr 9, 2020
  5. Junio C HamanoApr 9, 2020
  6. Jeff KingApr 9, 2020

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.