Re: git-diff bug?
- From
René Scharfe <l.s.r@web.de>
- Date
- Nov 2, 2020, 17:45 UTC
- Message-ID
- <72cfef26-e986-d34c-eea4-46ec0fda2688@web.de>
- In-Reply-To
- <CALO-guviA4xKjUi0HfA+RLkTPPaQw7KArj__A9fKz0oP3m5MGw@mail.gmail.com>
Am 02.11.20 um 07:53 schrieb Eli Barzilay:
Show 17 quoted lines
> 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.)
$ 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 1This 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.
$ git diff --ignore-blank-lines 1 2
$ git diff --ignore-blank-lines 2 1
$ git --version
git version 2.29.2This matches your expectation, but not your results. Which version do you use?
René