Junio C Hamano wrote: > Felipe Contreras <felipe.contreras@xxxxxxxxx> writes: > > > It doesn't make sense to display already-resolved conflicts in the > > different views of all mergetools. > > > > We already have the best version in MERGED, with annotations that can > > be used to extract a pruned version of LOCAL and REMOTE. If we are using > > the diff3 conflict-style, we can even extract BASE. > > > > Let's use these annotations instead of using the original files before > > the conflict resolution. > > > > TODO: There may be a better way to extract these files that doesn't rely > > on the user's conflict-style configuration. > > > > See Seth House's blog post [1] for the idea and the rationale. > > > > [1] https://www.eseth.org/2020/mergetools.html > > > > Cc: Seth House <seth@xxxxxxxxx> > > Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx> > > Hmph, I got what Seth showed, but I do not quite see how the ideas > in the post relate to what this patch does. The patch just avoids > grabbing the contents of each stage out to a file for three stages > using "git checkout-index" and instead does the same by munging the > diff3 output, which ought to have the same information at least for > text files, using "sed", or is there something I am not seeing? It's not quite the same information. Take the following script that uses Seth's example: ---------------------------------------- cat > BASE <<EOF A "Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jub jub bird, and shun The frumious bandersnatch!" EOF cat > LOCAL <<EOF B "Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jub jub bird, and shun The frumious bandersnatch!" EOF cat > REMOTE <<EOF C "Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!" EOF git merge-file "$@" --diff3 -p LOCAL BASE REMOTE ---------------------------------------- Notice how git is smart enough to resolve the conflicts of the second paragraph, so the user doesn't have to do anything. LOCAL is the equivalent of "git checkout-index --stage 2", but that doesn't have the resolved conflict. We could call "git merge-file --ours" and overwrite $LOCAL; that way the user is not presented with any diff for the second paragraph. The same with --theirs and $REMOTE, but there's no "git merge-file --base". The implementation details of the proposed patch are not relevant at this point; it was just to show an example of what Seth's diffconflicts vim plugin does. Cheers. -- Felipe Contreras