All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, David Aguilar <davvid@gmail.com>,
	Johannes Sixt <j6t@kdbg.org>, Seth House <seth@eseth.com>
Subject: Re: [RFC/PATCH] mergetool: use resolved conflicts in all the views
Date: Wed, 16 Dec 2020 17:41:51 -0600	[thread overview]
Message-ID: <5fda9b3f4979c_973f2083@natae.notmuch> (raw)
In-Reply-To: <xmqqa6ud2xuw.fsf@gitster.c.googlers.com>

Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@gmail.com> 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@eseth.com>
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> 
> 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

  parent reply	other threads:[~2020-12-16 23:42 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 17:43 [RFC/PATCH] mergetool: use resolved conflicts in all the views Felipe Contreras
2020-12-16 22:24 ` Junio C Hamano
2020-12-16 22:53   ` Seth House
2020-12-17  5:18     ` Junio C Hamano
2020-12-17  5:41     ` Felipe Contreras
2020-12-17  7:35       ` Johannes Sixt
2020-12-17  8:27         ` Felipe Contreras
2020-12-17 19:23           ` Johannes Sixt
2020-12-18  2:30             ` Felipe Contreras
2020-12-17  9:44         ` Seth House
2020-12-17 10:35           ` Felipe Contreras
2020-12-17 17:50             ` Seth House
2020-12-17 19:28               ` Junio C Hamano
2020-12-18  2:34                 ` Felipe Contreras
     [not found]                   ` <CANiSa6jMXTyfo43bUdC8601BvYKiF67HXo+QaiTh_-8KWyBsLg@mail.gmail.com>
2020-12-21  0:31                     ` Felipe Contreras
2020-12-18  2:05               ` Felipe Contreras
2020-12-18  2:35                 ` Seth House
2020-12-18  2:49                   ` Felipe Contreras
2020-12-18  5:49                     ` Seth House
2020-12-18  9:46                       ` Felipe Contreras
2020-12-19  0:13                         ` Seth House
2020-12-19  0:53                           ` Felipe Contreras
2020-12-19 11:14                           ` Junio C Hamano
2020-12-19 12:08                             ` Felipe Contreras
2020-12-19 18:26                               ` Junio C Hamano
2020-12-19 20:18                                 ` Felipe Contreras
2020-12-21  4:25                             ` Seth House
2020-12-21  5:34                               ` Felipe Contreras
2020-12-21  7:36                                 ` Seth House
2020-12-21 11:17                                   ` Felipe Contreras
2020-12-21 22:15                                   ` David Aguilar
2020-12-21 23:51                                     ` Code of conduct violation? Felipe Contreras
2020-12-22  7:13                                       ` Junio C Hamano
2020-12-22  9:58                                         ` Felipe Contreras
2020-12-22 15:01                                       ` Pratyush Yadav
2020-12-23  4:23                                         ` Felipe Contreras
2020-12-23  5:02                                           ` Junio C Hamano
2020-12-23  5:41                                             ` Felipe Contreras
2020-12-23 15:04                                               ` Nobody is THE one making contribution Junio C Hamano
2020-12-23 15:51                                                 ` Felipe Contreras
2020-12-23 20:56                                                   ` Junio C Hamano
2020-12-24  1:09                                                     ` Felipe Contreras
2020-12-24  2:01                                                   ` Ævar Arnfjörð Bjarmason
2020-12-24  5:19                                                     ` Felipe Contreras
2020-12-24 12:30                                                       ` Ævar Arnfjörð Bjarmason
2020-12-24 15:26                                                         ` Felipe Contreras
2020-12-24 22:57                                                           ` Junio C Hamano
2020-12-27 17:29                                                             ` Felipe Contreras
2020-12-27 18:30                                                               ` Junio C Hamano
2020-12-27 18:47                                                                 ` Felipe Contreras
2020-12-28 10:39                                                                   ` Junio C Hamano
2020-12-28 14:27                                                                     ` Felipe Contreras
2020-12-24 15:09                                                       ` Randall S. Becker
2020-12-24 15:37                                                         ` Felipe Contreras
2020-12-24 22:40                                                           ` Junio C Hamano
2020-12-24 21:00                                       ` Code of conduct violation? David Aguilar
2020-12-24 22:32                                         ` Felipe Contreras
2020-12-18 10:04                       ` [RFC/PATCH] mergetool: use resolved conflicts in all the views Junio C Hamano
2020-12-18 11:58                         ` Felipe Contreras
2020-12-19 18:52                           ` Junio C Hamano
2020-12-19 20:59                             ` Felipe Contreras
2020-12-20  6:44                               ` David Aguilar
2020-12-20  7:53                                 ` Felipe Contreras
2020-12-20 22:22                                   ` David Aguilar
2020-12-21  1:46                                     ` Felipe Contreras
2020-12-19  0:18                         ` Seth House
2020-12-16 23:41   ` Felipe Contreras [this message]
2020-12-17  5:19     ` Junio C Hamano
2020-12-17  5:43       ` Felipe Contreras
2020-12-17  2:35 ` [RFC/PATCH v2] " Felipe Contreras

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=5fda9b3f4979c_973f2083@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=seth@eseth.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.