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

Re: Fix "git diff --stat" for interesting - but empty - file changes

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Oct 17, 2012, 19:35 UTC
Message-ID
<CA+55aFzChDPv3Vu5D9rXmXvQmxoxsxgZYVEyf9CaUmYP+Xs0OA@mail.gmail.com>
In-Reply-To
<7v4nltoswd.fsf@alter.siamese.dyndns.org>
On Wed, Oct 17, 2012 at 11:28 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
>
> I think listing a file whose content remain unchanged with 0 as the
> number of lines affected makes sense, and it will mesh well with
> Duy's
>
>   http://thread.gmane.org/gmane.comp.version-control.git/207749
>
> I first wondered if we would get a division-by-zero while scaling
> the graph, but we do not scale smaller numbers up to fill the
> columns, so we should be safe.

Note that we should be safe for a totally different - and more fundamental - reason: the zero line case is by no means new. We've always done it for the rename case.

Show 7 quoted lines
> These days, we omit 0 insertions and 0 deletions, so I am not sure
> what you should get for this case, though:
>
>>  Makefile | 0
>>  1 file changed, 0 insertions(+), 0 deletions(-)
>
> Should we just say "1 file changed"?

If that is what it does for the rename case, then yes. I think it should fall out naturally.

              Linus
Previous: Junio C Hamano
Message 3 of 3 in “Fix "git diff --stat" for interesting - but empty - file changes”
  1. Linus TorvaldsOct 17, 2012
  2. Junio C HamanoOct 17, 2012
  3. Linus TorvaldsOct 17, 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.