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

Re: git-diff bug?

From
Eli Barzilay <eli@barzilay.org>
Date
Nov 2, 2020, 21:06 UTC
Message-ID
<CALO-gusRt4J5ar45mo7un-EENyt5cX2SQvcXgyMmaHNZg5bFUg@mail.gmail.com>
In-Reply-To
<72cfef26-e986-d34c-eea4-46ec0fda2688@web.de>
On Mon, Nov 2, 2020 at 12:45 PM René Scharfe <l.s.r@web.de> wrote:
Show 14 quoted lines
>
>     $ printf "aaa\nbbb\nccc\n\n" > 1
>     $ printf "aaa\nbbb\n\nccc\n" > 2
>
>     $ diff --ignore-blank-lines -u 1 2
>     --- 1       2020-11-02 18:11:04.618133008 +0100
>     +++ 2       2020-11-02 18:11:04.618133008 +0100
>     @@ -1,4 +1,4 @@
>      aaa
>      bbb
>     -ccc
>
>     +ccc
>     $ diff --ignore-blank-lines -u 2 1
Yes, this is what I'm getting, also without a -u.  (Also on 2.29.2)
> This matches your results.  That the order makes a difference is a bit
> odd.  Both are valid diffs of the inputs and neither one changes blank
> lines, though, so it doesn't look like a bug.

How is it valid? Isn't the whole point of `--ignore-blank-lines` to do the same thing as comparing a version of the files that drops all empty lines?

Show 8 quoted lines
>
>     $ git diff --ignore-blank-lines 1 2
>     $ git diff --ignore-blank-lines 2 1
>     $ git --version
>     git version 2.29.2
>
> This matches your expectation, but not your results.  Which version do
> you use?
$ git diff --ignore-blank-lines 1 2
diff --git a/1 b/2
index fc13a35..bd05737 100644
--- a/1
+++ b/2
@@ -1,4 +1,4 @@
 aaa
 bbb
-ccc

+ccc
$ git --version
git version 2.29.2
-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!
Previous: René ScharfeNext: Junio C Hamano
Message 3 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.