From: "René Scharfe" <email@example.com> To: Eli Barzilay <firstname.lastname@example.org>, git <email@example.com> Subject: Re: git-diff bug? Date: Mon, 2 Nov 2020 18:45:03 +0100 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <CALO-guviA4xKjUi0HfA+RLkTPPaQw7KArj__A9fKz0oP3m5MGw@mail.gmail.com> Am 02.11.20 um 07:53 schrieb Eli Barzilay: > 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 1 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. $ 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? René
next prev parent reply other threads:[~2020-11-02 17:45 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-02 6:53 Eli Barzilay 2020-11-02 17:45 ` René Scharfe [this message] 2020-11-02 21:06 ` Eli Barzilay 2020-11-02 22:14 ` Junio C Hamano 2020-11-03 3:14 ` Eli Barzilay 2020-11-03 16:58 ` Junio C Hamano 2020-11-02 22:00 ` Junio C Hamano
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: git-diff bug?' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).