From: Phillip Wood <phillip.wood123@gmail•com>
To: Yee Cheng Chin <ychin.git@gmail•com>, Junio C Hamano <gitster@pobox•com>
Cc: Yee Cheng Chin via GitGitGadget <gitgitgadget@gmail•com>,
git@vger•kernel.org
Subject: Re: [PATCH] xdiff: re-diff shifted change groups when using histogram algorithm
Date: Fri, 30 Jan 2026 16:06:10 +0000 [thread overview]
Message-ID: <b66b8781-a826-44e0-9a2b-2c3a57547f06@gmail.com> (raw)
In-Reply-To: <CAHTeOx-TLwqbcdGcb2drD4vE6D3M93EPMjcAeTNR+XNTbmTVZg@mail.gmail.com>
On 30/01/2026 01:58, Yee Cheng Chin wrote:
>
> Case #1 happens when no *remaining* shifting was necessary, but note
> that this happens after the do/while loop above, where previous loops
> could have shifted and compacted the diff blocks already. Case #2 just
> means there's some remaining clean up work to be done.
That's a good point - as well as commenting the new code, it would be
helpful to update the comment in case #1 to make it clear that we don't
need to shift back up to align with a matching block, not there there
was no shift possible. I agree with Junio that it would be useful to add
the example below as a test
Thanks
Phillip
> Just for a concrete test case that will illustrate this in case
> someone is running the code and want a demonstration:
>
> File 1:
> AXB*
>
> File 2:
> CD*XE*
>
> The first "*" is used as the histogram alignment anchor, which will be
> shifted resulting in a compaction, and therefore needs to trigger a
> re-diff. The correct output is as follows (which will only happen if
> we also run the re-diff in case #1):
>
> {-A-}[+CD*+]X{-B-}[+E+]*
>
> Otherwise we will get the wrong output (note how the "X" is
> erroneuously included on both sides):
>
> {-AXB-}[+CD*XE+]*
>
> Because of that, I'm leaning on keeping the current code structure,
> because it *is* indeed a cleanup step to be run after the previous
> one. I could still refactor it into a separate function and put it
> into the the case #1/#2 if blocks if you think that's cleaner.
>
> I will also add the above to the test case in v2.
>
next prev parent reply other threads:[~2026-01-30 16:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 20:51 [PATCH] xdiff: re-diff shifted change groups when using histogram algorithm Yee Cheng Chin via GitGitGadget
2026-01-21 20:51 ` Junio C Hamano
2026-01-24 10:54 ` Phillip Wood
2026-01-25 17:34 ` Junio C Hamano
2026-01-26 9:37 ` Phillip Wood
2026-01-26 17:32 ` Junio C Hamano
2026-01-29 16:53 ` Yee Cheng Chin
2026-01-29 20:58 ` Junio C Hamano
2026-01-30 1:58 ` Yee Cheng Chin
2026-01-30 5:43 ` Junio C Hamano
2026-01-30 16:06 ` Phillip Wood [this message]
2026-02-20 23:07 ` Junio C Hamano
2026-02-21 9:56 ` Yee Cheng Chin
2026-03-02 14:54 ` [PATCH v2] " Yee Cheng Chin via GitGitGadget
2026-03-13 7:07 ` Junio C Hamano
2026-03-13 10:23 ` Phillip Wood
2026-03-19 23:30 ` Yee Cheng Chin
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=b66b8781-a826-44e0-9a2b-2c3a57547f06@gmail.com \
--to=phillip.wood123@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitgitgadget@gmail$(echo .)com \
--cc=gitster@pobox$(echo .)com \
--cc=phillip.wood@dunelm$(echo .)org.uk \
--cc=ychin.git@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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