From: Junio C Hamano <gitster@pobox.com>
To: Adam Spiers <git@adamspiers.org>
Cc: git list <git@vger.kernel.org>
Subject: Re: [PATCH 0/1] add git-splice subcommand for non-interactive branch splicing
Date: Mon, 31 Jul 2017 15:18:21 -0700 [thread overview]
Message-ID: <xmqqo9s0gsia.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <cover.55495badd28b73b39c60ca4107b50aae7ee95028.1501535033.git-series.git@adamspiers.org> (Adam Spiers's message of "Mon, 31 Jul 2017 22:18:48 +0100")
Adam Spiers <git@adamspiers.org> writes:
> Therefore there is a risk that each new UI for higher-level workflows
> will end up re-implementing these mid-level operations. This
> undesirable situation could be avoided if git itself provided those
> mid-level operations.
Let me make sure if I get your general idea right, first.
Is your aim is to give a single unified mid-layer that these other
tools can build on instead of rolling their own "cherry-pick these
ranges, then squash that in, and then merge the other one in, ..."
sequencing machinery?
If so, I think that is a very good goal.
> # Remove commits A..B (i.e. excluding A) from the current branch.
> git splice A..B
> # Remove commit A from the current branch.
> git splice A^!
> # Remove commits A..B from the current branch, and cherry-pick
> # commits C..D at the same point.
> git splice A..B C..D
We need to make sure that the mid-layer tool offers a good set of
primitive operations that serve all of these other tools' needs. I
do not know offhand if what you implemented that are illustrated by
these examples is or isn't that "good set".
Assuming that there is such a "good set of primitives" surfaced at
the UI level so that these other tools can express what they want to
perform with, I'd personally prefer to see a solution that extends
and uses the common "sequencer" machinery we have been using to
drive cherry-picks, reverts and interactive rebases that work on
multiple commits. IOW, it would be nice to see that the only thing
"git splice A..B" does is to prepare a series of instructions in a
file, e.g. .git/sequencer/todo, just like "git cherry-pick A..B"
would, and let the sequencer machinery to handle the sequencing.
E.g. In a history like
---o---A---o---B---X---Y---Z HEAD
"git splice A..B" command would write something like this:
reset to A
pick X
pick Y
pick Z
to the todo file and drive the sequencer. As you notice, you would
need to extend the vocabulary of the sequencer a bit to allow
various things that the current users of the sequencer machinery do
not need, like resetting the HEAD to a specific commit, merging a
side branch, remembering the result of an operation, and referring
to such a commit in later operation. For example, if you tell "git
splice" to expunge A from this sample history (I am not sure how you
express that operation in your UI):
B---C---D
/ \
---o---A---E---F---G HEAD
it might create a "todo" list like this to rebuild the history:
reset to A^
pick B
pick C
pick D
mark :1
reset to A^
pick E
merge :1 using F's log message and conflict resolution as reference
pick G
to result in:
B---C---D
/ \
---o-------E---F---G HEAD
Do not pay too much attention to how the hypothetical "extended todo
instruction set" is spelled in the above illustration (e.g. I am not
advocating for multi-word command like "reset to"); these are only
to illustrate what kind of features would be needed for the job. In
the final shape of the system, "merge" in the illustration above may
be a more succinct "merge F :1", for example (i.e. the first
parameter would name an existing merge to use as reference, the
remainder is a list of commits to be merged to the current HEAD),
just like "pick X" is a succinct way to say "cherry-pick the change
introduced by existing commit X to HEAD, reusing X's log message
and author information".
Something like that may have a place in the git-core, I would think.
I am not sure if a bash script that calls rebase/cherry-pick/commit
manually can serve as a good "universal mid-layer" or just adding
another random command to the set of existing third-party commands
for "higher-level workflows".
next prev parent reply other threads:[~2017-07-31 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 21:18 [PATCH 0/1] add git-splice subcommand for non-interactive branch splicing Adam Spiers
2017-07-31 21:18 ` [PATCH 1/1] add git-splice command " Adam Spiers
2017-07-31 22:18 ` Junio C Hamano [this message]
2017-08-01 1:14 ` [PATCH 0/1] add git-splice subcommand " Adam Spiers
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=xmqqo9s0gsia.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@adamspiers.org \
--cc=git@vger.kernel.org \
/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).