From: Jeff King <peff@peff.net>
To: Gabriel Holodak <gthepiper@gmail.com>
Cc: Stefan Beller <sbeller@google.com>, git@vger.kernel.org
Subject: Re: Possible bug: identical lines added/removed in git diff
Date: Wed, 29 Aug 2018 22:54:57 -0400 [thread overview]
Message-ID: <20180830025457.GA665@sigill.intra.peff.net> (raw)
In-Reply-To: <CAE6=WB_t7zG3jtELiMfggqxjvD4jJyJ02pNPmV3fey=3nSejuA@mail.gmail.com>
On Wed, Aug 29, 2018 at 10:10:25PM -0400, Gabriel Holodak wrote:
> > Could you cut down to a real minimal reproduction, i.e. just these 20
> > lines or so?
>
> I'm working on getting down to a minimal reproduction, a few lines at
> a time. One thing that seems strange: as I've removed lines, there are
> a bunch of lines that don't matter. Then I'll find some lines that, if
> removed, completely fix the issue. But the ordering for these
> apparently important lines doesn't matter. They just have to be
> somewhere in the file to cause the duplicated diffs.
>
> I'll upload again when I've figured out all the unimportant lines to remove.
Yeah, I reproduced based on your initial post, but noticed that when I
cut it down the problem went away.
An easy and pretty mechanical reproduction is:
git diff --no-index unitera_bold_italic.bdf.{old,new} |
sed -ne '/STARTCHAR U+00F0/,/ENDCHAR/p'
which shows a hunk that could easily be reduced by its first line
("DWIDTH 8 0"), and which has a common line in the middle of -/+ run.
But if we cut it down to the lines in that hunk, like this:
for i in unitera_bold_italic.bdf.{old,new}; do
sed -ne '/STARTCHAR U+00F0/,/ENDCHAR/p' <$i >$i.cut
done
git diff --no-index unitera_bold_italic.bdf.{old,new}.cut
then those two lines become context.
I note also that GNU "diff -u" gets this case right.
> > Do you have any smudge filters or configuration regarding
> > line endings?
>
> No filters, I did have core.autocrlf = input. But as I mentioned, I
> can also reproduce with an empty config.
Me too. Amusingly, if you have diff.colorMoved configured, the context
lines appear as moves, showing that we really do know they're the same
(but that happens as post-diff processing, so I am not at all surprised
that it is orthogonal to the original issue).
-Peff
next prev parent reply other threads:[~2018-08-30 2:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 1:54 Possible bug: identical lines added/removed in git diff Gabriel Holodak
2018-08-27 17:47 ` Stefan Beller
2018-08-30 2:10 ` Gabriel Holodak
2018-08-30 2:54 ` Jeff King [this message]
2018-08-30 19:16 ` Stefan Beller
2018-08-30 19:20 ` Jeff King
2018-08-30 19:28 ` Stefan Beller
2018-08-31 21:38 ` Johannes Schindelin
2018-09-01 15:23 ` Stefan Beller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180830025457.GA665@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gthepiper@gmail.com \
--cc=sbeller@google.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).