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

Re: [PATCH 0/5] "diff --stat" counting fixes

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 2, 2012, 02:23 UTC
Message-ID
<7vhao5mbtx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALWbr2xYrWkfSCUc7gocVGLQP_RHjWrMmFspPe5O_ekjisNqxw@mail.gmail.com>
Antoine Pelisse <apelisse@gmail.com> writes:
> I feel like (but I can obviously be wrong):
> 1. The info is redundant. When performing a merge, all diffs (without
> --staged flag) are unmerged

Yes, it is redundant. They are primarily meant as a warning to anybody who runs "git diff --stat" while their index is not fully merged so that they do not mistakenly think they are looking at meaningful numbers. The number of added lines likely includes the conflict markers you haven't dealt with ;-)

> 2. While status shows the line once, while diff shows the diff for the file
> once, while diff --shortstat counts the file once, diff --stat shows two
> lines for the file.
Yeah, don't use shortstat while your index is unmerged.
> 3. diff --numstat shows two lines for the same file. As a script
> writer (I guess that's what it's meant for), I would definitely expect
> uniqueness in third column/filenames.

Then your script wouldn't receive any hint in the output that you are reading from a nonsense input. When you see the same filename twice, you will know there is something strange (not just "I seem to have more added lines than I thought I added -- Ah, I see added files from both sides because I still have conflicts unresolved") that gives you a chance to notice.

Previous: Antoine Pelisse
Message 15 of 15 in “"diff --stat" counting fixes”
  1. 0/5 "diff --stat" counting fixesJunio C Hamano, Nov 27, 2012
  2. 1/5 test: add failing tests for "diff --stat" to t4049Junio C Hamano, Nov 27, 2012
  3. 2/5 diff --stat: status of unmodified pair in diff-q is not zeroJunio C Hamano, Nov 27, 2012
  4. 3/5 diff --stat: use "file" temporary variable to refer to data->files[i]Junio C Hamano, Nov 27, 2012
  5. 4/5 diff --stat: move the "total count" logic to the last loopJunio C Hamano, Nov 27, 2012
  6. 5/5 diff --stat: do not count "unmerged" entriesJunio C Hamano, Nov 27, 2012
  7. 6/5 diff --shortstat: do not count "unmerged" entriesJunio C Hamano, Nov 27, 2012
  8. t4049: avoid test failures on filemode challenged file systems (Windows)Johannes Sixt, Nov 29, 2012
  9. Junio C HamanoNov 29, 2012
  10. Junio C HamanoNov 29, 2012
  11. Junio C HamanoNov 29, 2012
  12. Johannes SixtNov 30, 2012
  13. Junio C HamanoDec 2, 2012
  14. Antoine PelisseDec 1, 2012
  15. Junio C HamanoDec 2, 2012

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.