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

Re: Possible bug: identical lines added/removed in git diff

From
GHGabriel Holodak <gthepiper@gmail.com>
Date
Aug 30, 2018, 02:10 UTC
Message-ID
<CAE6=WB_t7zG3jtELiMfggqxjvD4jJyJ02pNPmV3fey=3nSejuA@mail.gmail.com>
In-Reply-To
<CAGZ79kZ1BVTLnNYSs+NjEO1T1-PySSdZzVU-0ZfivjT_pfvviQ@mail.gmail.com>

I did have some possibly interfering settings in my .gitconfig previously. I removed everything, so all the commands I'll describe were run with an empty config.

On Mon, Aug 27, 2018 at 1:47 PM Stefan Beller <sbeller@google.com> wrote:
Show 7 quoted lines
> I suspected you might have a different diff algorithm configured,
> so I tested
>     git diff --no-index old new
>     git diff --patience --no-index old new
>     git diff --histogram --no-index old new
>
> all of which do not reproduce the issue.

I don't believe I had any settings to change the algorithm. Using any of --minimal, --patience, or --histogram seems to fix the issue. It still occurs with --diff-algorithm=default. I also tried --no-indent-heuristic, which had no effect.

Show 5 quoted lines
> Are there any encoding issues locally (Which platform
> are you on?) or in transit (Could you re-download the files
> from [1] and confirm it still produces this bug?)
>
> [1] https://public-inbox.org/git/CAE6=WB_4_PhjfQpubFcYkNKejfDr22s-y0nPQKw5Yd4GVaN4Yw@mail.gmail.com/

I should have mentioned before, this is on Arch Linux. I can reproduce from the downloaded files. I can also reproduce on macOS 10.13.6, with git 2.18.0.

> 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.
> 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.

> Are the lines really different or the same ? (Can you inspect with a
> hex editor, maybe there are different kinds of invisible white spaces?)
Yep, the lines in question are identical.

Thanks for looking into this. Gabriel

Previous: Stefan BellerNext: Jeff King
Message 3 of 9 in “Possible bug: identical lines added/removed in git diff”
  1. Gabriel HolodakAug 27, 2018
  2. Stefan BellerAug 27, 2018
  3. Gabriel HolodakAug 30, 2018
  4. Jeff KingAug 30, 2018
  5. Stefan BellerAug 30, 2018
  6. Jeff KingAug 30, 2018
  7. Stefan BellerAug 30, 2018
  8. Johannes SchindelinAug 31, 2018
  9. Stefan BellerSep 1, 2018

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.