All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Elijah Newren <newren@gmail.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>,
	Sergey Organov <sorganov@gmail.com>, Johannes Sixt <j6t@kdbg.org>
Subject: Re: [PATCH v2 1/2] xdiff: implement a zealous diff3, or "zdiff3"
Date: Fri, 24 Sep 2021 11:09:21 +0100	[thread overview]
Message-ID: <69635d07-7b4e-e94e-db98-0b8f4ea566d7@gmail.com> (raw)
In-Reply-To: <CABPp-BHXUNTuYPdCzfKhkvr23W3PODzti84bed6uEP5q+sj0TQ@mail.gmail.com>

On 18/09/2021 23:06, Elijah Newren wrote:
> On Wed, Sep 15, 2021 at 4:22 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
>>
>> On 15/09/2021 11:25, Phillip Wood wrote:
>>> I do wonder (though a brief try failed to trigger it) if there are cases
>>> where the diff algorithm does something "clever" which means it does not
>>> treat a common prefix or suffix as unchanged (see d2f82950a9
>>> ("Re(-re)*fix trim_common_tail()", 2007-12-20) for a related issue). We
>>> could just trim the common prefix and suffix from the two sides
>>> ourselves using xdl_recmatch().
>>
>> Here is an evil test case that shows this problem (diff on top of your patch)
>>
>>
>> diff --git a/t/t6427-diff3-conflict-markers.sh b/t/t6427-diff3-conflict-markers.sh
>> index de9c6190b9..836843c6b0 100755
>> --- a/t/t6427-diff3-conflict-markers.sh
>> +++ b/t/t6427-diff3-conflict-markers.sh
>> @@ -219,8 +219,9 @@ test_setup_zdiff3 () {
>>                   test_write_lines 1 2 3 4 5 6 7 8 9 >basic &&
>>                   test_write_lines 1 2 3 AA 4 5 BB 6 7 8 >middle-common &&
>>                   test_write_lines 1 2 3 4 5 6 7 8 9 >interesting &&
>> +               test_write_lines 1 2 3 4 5 6 7 8 9 >evil &&
>>
>> -               git add basic middle-common &&
>> +               git add basic middle-common interesting evil &&
>>                   git commit -m base &&
>>
>>                   git branch left &&
>> @@ -230,19 +231,21 @@ test_setup_zdiff3 () {
>>                   test_write_lines 1 2 3 4 A B C D E 7 8 9 >basic &&
>>                   test_write_lines 1 2 3 CC 4 5 DD 6 7 8 >middle-common &&
>>                   test_write_lines 1 2 3 4 A B C D E F G H I J 7 8 9 >interesting &&
>> +               test_write_lines 1 2 3 4 X A B C 7 8 9 >evil &&
>>                   git add -u &&
>>                   git commit -m letters &&
>>
>>                   git checkout right &&
>>                   test_write_lines 1 2 3 4 A X C Y E 7 8 9 >basic &&
>>                   test_write_lines 1 2 3 EE 4 5 FF 6 7 8 >middle-common &&
>>                   test_write_lines 1 2 3 4 A B C 5 6 G H I J 7 8 9 >interesting &&
>> +               test_write_lines 1 2 3 4 Y A B C B C 7 8 9 >evil &&
>>                   git add -u &&
>>                   git commit -m permuted
>>           )
>>    }
>>
>> -test_expect_failure 'check zdiff3 markers' '
>> +test_expect_success 'check zdiff3 markers' '
> 
> ...except your new testcase makes it fail.

Sorry I meant to remove that, I'd changed it to test_expect_success so I 
could poke about in the test repo when it failed.

Best Wishes

Phillip

> 
>>           test_setup_zdiff3 &&
>>           (
>>                   cd zdiff3 &&
>> @@ -251,6 +254,14 @@ test_expect_failure 'check zdiff3 markers' '
>>
>>                   test_must_fail git -c merge.conflictstyle=zdiff3 merge -s recursive right^0 &&
>>
>> +               test_write_lines \
>> +                       1 2 3 4 \
>> +                       "<<<<<<< HEAD" X A \
>> +                       "||||||| $(git rev-parse --short HEAD^1)" 5 6 ======= \
>> +                       Y A B C ">>>>>>> right^0" \
>> +                       B C 7 8 9 >expect &&
>> +               test_cmp expect evil &&
>> +
> 
> Yeah, this is an interesting testcase, and I agree with the 'expect'
> choice you wrote, but the current code doesn't produce it.  I'll
> update the patches and send out another round, and then do you want to
> try your xdl_recmatch() magic to fix this testcase?
> 


  reply	other threads:[~2021-09-24 10:09 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  5:16 [PATCH 0/2] RFC: implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-06-15  5:16 ` [PATCH 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-06-15  6:13   ` Junio C Hamano
2021-06-15  9:40   ` Felipe Contreras
2021-06-15 18:12     ` Elijah Newren
2021-06-15 18:50       ` Sergey Organov
2021-06-15  5:16 ` [PATCH 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-06-15  6:21   ` Junio C Hamano
2021-06-15  9:43 ` [PATCH 0/2] RFC: implement new zdiff3 conflict style Jeff King
2021-06-15 19:35   ` Elijah Newren
2021-06-16  8:57     ` Phillip Wood
2021-06-16 10:31       ` Jeff King
2021-06-23  9:53         ` Phillip Wood
2021-06-23 22:28           ` Jeff King
2021-06-17  5:03       ` Elijah Newren
2021-06-15 21:36 ` Johannes Sixt
2021-06-15 21:45   ` Elijah Newren
2021-06-16  6:16     ` Johannes Sixt
2021-06-16  8:14       ` Elijah Newren
2021-09-11 17:03 ` [PATCH v2 " Elijah Newren via GitGitGadget
2021-09-11 17:03   ` [PATCH v2 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-09-15 10:25     ` Phillip Wood
2021-09-15 11:21       ` Phillip Wood
2021-09-18 22:06         ` Elijah Newren
2021-09-24 10:09           ` Phillip Wood [this message]
2021-09-18 22:04       ` Elijah Newren
2021-09-24 10:16         ` Phillip Wood
2021-09-11 17:03   ` [PATCH v2 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-09-18 23:02   ` [PATCH v3 0/2] RFC: implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-09-18 23:02     ` [PATCH v3 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-09-18 23:02     ` [PATCH v3 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-11-16  2:13     ` [PATCH v4 0/2] Implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-11-16  2:13       ` [PATCH v4 1/2] xdiff: implement a zealous diff3, or "zdiff3" Phillip Wood via GitGitGadget
2021-11-16  2:13       ` [PATCH v4 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-12-01  0:05       ` [PATCH v5 0/2] Implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-12-01  0:05         ` [PATCH v5 1/2] xdiff: implement a zealous diff3, or "zdiff3" Phillip Wood via GitGitGadget
2021-12-01  0:05         ` [PATCH v5 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-12-02  8:42           ` Bagas Sanjaya
2021-12-02 13:28             ` Eric Sunshine

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=69635d07-7b4e-e94e-db98-0b8f4ea566d7@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=j6t@kdbg.org \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sorganov@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.