git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Martin von Zweigbergk <martinvonz@gmail.com>
To: Edmundo Carmona Antoranz <eantoranz@gmail.com>
Cc: Elijah Newren <newren@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [RFC] introducing git replay
Date: Sun, 17 Apr 2022 10:22:54 -0700	[thread overview]
Message-ID: <CANiSa6g7ShxTXNEyJEyb==qCYNAMrNf30VkDPaydvOo0Bm+Onw@mail.gmail.com> (raw)
In-Reply-To: <CAOc6etb7fmO2FAv09+wHsDBwnLsBi+B-CwRarm2tfYS-aUWcfg@mail.gmail.com>

On Sun, Apr 17, 2022 at 5:30 AM Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:
>
> On Sun, Apr 17, 2022 at 7:05 AM Elijah Newren <newren@gmail.com> wrote:
> >
> >
> > Replaying merges is something I've put a little thought into, so allow
> > me to provide some pointers that may help.  Merges need special
> > handling for replaying, and in my opinion, doing either just a new
> > merge of the new trees (what rebase --rebase-merges does), or just
> > reusing existing trees (what you proposed to start this thread) are
> > both suboptimal, though the former is likely to just be annoying and
> > require potentially unnecessary user refixing, whereas the latter can
> > silently discard changes or reintroduce discarded changes and could be
> > dangerous.  More details on both of these...
> >
> > An important part about merges is they may have resolved conflicts --
> > both textual (the standard conflict markers people have to resolve)
> > and semantic (e.g. one person changes the API of some function, and
> > the other branch being merged adds a caller of that function, so the
> > merge has to modify the new caller to use the new API).  We do not
> > just want to do a new merge and re-use the commit message (as rebase
> > --rebase-merges does), for two reasons: (1) the user either has to
> > re-resolve the textual conflict resolutions by hand, or use rerere
> > which requires a working tree (and we'd like replays to proceed
> > without a working tree where possible), and (2) it tosses semantic
> > merge conflict resolutions entirely.  We also do not just want to use
> > existing trees as-is (as you started with in your patch), for three
> > reasons: (1) when we move to a new base the new merge needs to include
> > the changes from the newer base, (2) the topic might have additional
> > changes added (or removed) during the "rebase" which need to be
> > reflected in the merge as well, and (3) the merge may have had
> > additional changes stuffed directly into it to solve semantic
> > conflicts which we want "ported" to the new merge commit.    So, for
> > handling merges, we should avoid both of these overly simplistic
> > mechanisms, and do something that tries to handle forward-porting
> > these conflict resolutions.  I have outlined steps to do so at
> > https://lore.kernel.org/git/CABPp-BHp+d62dCyAaJfh1cZ8xVpGyb97mZryd02aCOX=Qn=Ltw@mail.gmail.com/
> >
>
> Hey, Elijah! Thanks for taking the time and the feedback.
>
> Forget about me introducing replay as a separate command as a "real"
> proposal. My intent (and which I saw most simple to be able to show
> it) was to present the idea of an optimization (if you will) to the
> rebase mechanism under certain rather narrow conditions:
>
> git rebase --onto A B C
>
> if A^{tree} == B^{tree} that means that we could create an equivalent
> commit for the segment B..C on top of A without much hassle by reusing
> the same trees from that segment (no need to calculate new trees...and
> no need to move along the working tree as we are creating those
> commits).
>
> My impression from reading your feedback is that you have a much
> broader scope in terms of what you want to achieve.So, for the time
> being, I will work on trying to get the optimization in rebase and see
> how far I am able to move it forward.... and you are able to keep
> replay as a separate command if that is your will for the
> not-so-distant future. :-)

My (Git-compatible) VCS [1] is very relevant to this thread. It always
treats the contents of a merge commit as the diff compared to the
re-merge (auto-merged) parents. That applies to diffs (like
--remerge-diff) and rebases (what Elijah suggested in that link above)
. An important part of the solution I went with is to store
information about conflicts in the commits. Note that it's a more
high-level representation of the conflicts - not conflict *markers* -
that's stored in the commits [2]. Adding a new kind of object type is
obviously a huge step to take for Git, but perhaps you can consider it
as long as these objects are not exchanged. Also, as you have probably
noticed with your `git replay` command, this kind of rebasing without
touching the working copy or trees can get pretty fast. I didn't see
any performance numbers in your original message, but you are probably
able to rebase >1k commits per second in the git.git repo [3].

[1] https://github.com/martinvonz/jj
[2] https://github.com/martinvonz/jj/blob/main/docs/technical/conflicts.md
[3] https://github.com/martinvonz/jj/discussions/49

  reply	other threads:[~2022-04-17 17:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13 16:43 [RFC] introducing git replay Edmundo Carmona Antoranz
2022-04-13 17:05 ` Junio C Hamano
2022-04-15 18:46   ` Edmundo Carmona Antoranz
2022-04-15 20:33     ` Junio C Hamano
2022-04-16  5:35       ` Edmundo Carmona Antoranz
2022-04-16  6:39         ` Junio C Hamano
2022-04-16  7:02           ` Edmundo Carmona Antoranz
2022-04-17  5:05         ` Elijah Newren
2022-04-17  5:37           ` Edmundo Carmona Antoranz
2022-04-17 17:22             ` Martin von Zweigbergk [this message]
2022-04-18  7:04               ` Edmundo Carmona Antoranz
2022-04-18  7:29           ` Sergey Organov
2022-04-18 16:27             ` Elijah Newren
2022-04-18 17:33               ` Sergey Organov
2022-04-20 11:27               ` Tao Klerks
2022-04-21  2:33                 ` Elijah Newren
2022-04-13 17:26 ` rsbecker
2022-04-13 17:30   ` Edmundo Carmona Antoranz
2022-04-13 17:44     ` Edmundo Carmona Antoranz
2022-04-13 17:44 ` Phillip Susi
2022-04-13 17:49   ` Edmundo Carmona Antoranz
2022-04-13 19:07     ` Ævar Arnfjörð Bjarmason
2022-04-13 17:48 ` Junio C Hamano
2022-04-13 17:56   ` Edmundo Carmona Antoranz
2022-04-13 20:06   ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANiSa6g7ShxTXNEyJEyb==qCYNAMrNf30VkDPaydvOo0Bm+Onw@mail.gmail.com' \
    --to=martinvonz@gmail.com \
    --cc=eantoranz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).