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

git-diff bug?

From
Eli Barzilay <eli@barzilay.org>
Date
Nov 2, 2020, 06:53 UTC
Message-ID
<CALO-guviA4xKjUi0HfA+RLkTPPaQw7KArj__A9fKz0oP3m5MGw@mail.gmail.com>
Is the following a bug?
    $ printf "aaa\nbbb\nccc\n\n" > 1
    $ printf "aaa\nbbb\n\nccc\n" > 2
    $ git diff --ignore-blank-lines 1 2

This shows a weird output, as if `ccc` was removed and then re-added. Flipping the 1 & 2 names makes it show no difference at all. I tried a bunch of variants, including --minimal, and the four algorithms, and all show the same results. (Similar brokenness happens with an empty line at the beginning on one side and after the first line on the other.)

I'm really not sure that the following is a bug, because I see the same behavior from `diff` (which is what made me try git-diff, hoping that it would be more consistent). (But I can't think of any rational that would make it not a bug.)

-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!
Next: René Scharfe
Message 1 of 7 in “git-diff bug?”
  1. Eli BarzilayNov 2, 2020
  2. René ScharfeNov 2, 2020
  3. Eli BarzilayNov 2, 2020
  4. Junio C HamanoNov 2, 2020
  5. Eli BarzilayNov 3, 2020
  6. Junio C HamanoNov 3, 2020
  7. Junio C HamanoNov 2, 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.