Thread (6 messages) 6 messages, 3 authors, 2022-08-17

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

From: Johannes Schindelin <hidden>
Date: 2022-08-16 12:14:40

Hi Junio,

On Wed, 10 Aug 2022, Junio C Hamano wrote:
While I agree that it would make sense to rewrite some strategies in
C, I do not quite see the point of redoing this particular one.  Its
simplicity is one of the only few remaining shining points in the
"resolve" strategy, and it can serve as an easy-to-understand
example to demonstrate what a merge-strategy implementation should
look like.
I am sure we can do much better than

	https://github.com/git/git/blob/v2.37.2/git-merge-resolve.sh

when it comes to demonstrating a script to implement a custom merge
strategy. The really nice thing about a custom merge strategy, after all,
is that you can forgo pretty much all error handling and command-line
parsing because you know precisely how you are going to use it.
I however doubt with improvements to the "recursive" and more recently
the "ort" strategy, I do not know how much "real" use there is to it.  I
even suspect that the users do not mind if a platform does not ship this
strategy by default if it has so much problem running a shell script.

By rewriting it to C, we would lose an easy-to-understand example that
the users can easily run to see how it works, but what we gain in
exchange is not clear, at least to me.
We reduce Git's reliance on POSIX shell scripting, we reduce the number of
programming languages contributors need to be familiar with, we open up to
code coverage/static analysis tools that handle C but not shell scripts,
just to name a few.

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.

I would also have understood a lament about the absence of any good
example in https://git-scm.com/docs/git-merge#_merge_strategies to help
users develop their own custom merge strategies.

I'm all in favor of adding such a good example there, but there is no
reason to hold back `git merge-resolve` from being implemented in C.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help