Re: [PATCH v8 08/14] merge-resolve: rewrite in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 18, 2022 at 7:42 AM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> wrote:
>
> On Wed, Aug 17 2022, Junio C Hamano wrote:
>
> > Elijah Newren <newren@xxxxxxxxx> writes:
> >
> >> There's also another concern you tried to address in your other email;
> >> let me quote from that email here:
> >>
> >>> If you want to have an easy example of a custom merge strategy, then let's
> >>> have that easy example. `git-merge-resolve.sh` ain't that example.
> >>>
> >>> It would be a different matter if you had commented about
> >>> `git-merge-ours.sh`:
> >>> https://github.com/git/git/blob/v2.17.0/contrib/examples/git-merge-ours.sh
> >>> That _was_ a simple and easy example.
> >>
> >> ...and it was _utterly useless_ as an example.  It only checked that
> >> the user hadn't modified the index since HEAD.  It doesn't demonstrate
> >> anything about how to merge differing entries, since that merge
> >> strategy specifically ignores changes made on the other side.  Since
> >> merging differing entries is the whole point of writing a strategy, I
> >> see no educational value in that particular script.
> >>
> >> `git-merge-resolve.sh` may be an imperfect example, but it's certainly
> >> far superior to that.
> >> ...
> >> If someone makes a better example (which I agree could be done,
> >> especially if it added lots of comments about what was required and
> >> why), and ensures we keep useful test coverage (maybe using Junio's
> >> c-resolve suggestion in another email), then my concerns about
> >> reimplementing git-merge-resolve.sh in C go away.
> >>
> >> If that happens, then I still think it's a useless exercise to do the
> >> reimplementation -- unless someone can provide evidence of `-s
> >> resolve` being in use -- but it's not a harmful exercise and wouldn't
> >> concern me.
> >>
> >> If the better example and mechanism to retain good test coverage
> >> aren't provided, then I worry that reimplementing is a bunch of work
> >> for an at best theoretical benefit, coupled with a double whammy
> >> practical regression.
> >
> > Ah, you said many things I wanted to say already.  Thanks.
>
> I may have missed something in this thread, but wouldn't an acceptable
> way to please everyone here be to:
>
>  1. Have git's behavior be that of the end of this series...
>  2. Add a GIT_TEST_* mode where we'll optionally invoke these "built-in"
>     merge strategies as commands, i.e. have them fall back to
>     "try_merge_command()".

In the portion of the email you quoted and responded to, most of the
text was talking about how git-merge-resolve.sh serves an important
educational purpose, yet you've only tried to address the testing
issue.  I think both are important.  The easiest way to fix the
educational shortcoming of this series is to reverse the deleting of
git-merge-resolve.sh, and restore the building and distribution of
git-merge-resolve from that script.  Unfortunately, that generates a
collision between both the script and the builtin being used to build
the same file (namely, git-merge-resolve)...which is yet another
reason that the easiest solution available here is to just not rewrite
this script in C at all.

There are certainly other possible solutions to the educational issue,
and might not even be too hard, but we'd need someone to implement one
before I'd agree we found an "acceptable way to please everyone".  :-)

> So something like this on top of this series (assume my SOB etc. if this
> is acceptable). I only tested this locally, but it seems to do the right
> thing for me:
<snip patch>

How did you test?  I'm a bit confused...unless I'm misreading
something, it appears to me that ci/lib.sh sets SKIP_DASHED_BUILT_INS
unconditionally which would probably cause your proposal to break.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux