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

Re: git-diff bug?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 2, 2020, 22:14 UTC
Message-ID
<xmqqlffjs8ws.fsf@gitster.c.googlers.com>
In-Reply-To
<CALO-gusRt4J5ar45mo7un-EENyt5cX2SQvcXgyMmaHNZg5bFUg@mail.gmail.com>
Eli Barzilay <eli@barzilay.org> writes:
Show 5 quoted lines
>> 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?

Just this part. Any patch output that correctly explains how the preimage text changed to the postimage text is a "valid" diff, and that is how René used the word. There are multiple "valid" diff to bring the preimage to the postimage:

    (preimage)          (postimage)
    aaa                 aaa
    bbb                 bbb
    ccc
                        ccc
In an extreme case, this diff is even valid.
    @@ -1,4 +1,4 @@
    -aaa
    -bbb
    -ccc
    -
    +aaa
    +bbb
    +
    +ccc

It's just that it is not as _useful_ as other valid diff that explains how the preimage changed to the postimage.

HTH.
Previous: Eli BarzilayNext: Eli Barzilay
Message 4 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.