git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Psidium Guajava <psiidium@gmail.com>,
	Stefan Beller <sbeller@google.com>, Paul Tan <pyokagan@gmail.com>,
	git <git@vger.kernel.org>
Subject: Re: git-rebase --undo-skip proposal
Date: Thu, 15 Feb 2018 14:02:48 +0100 (STD)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1802151308501.35@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz> (raw)
In-Reply-To: <CA+P7+xrNPe5106qSjs1BiGJ5RbVxmR=MiGNVeCAUbT3gR0cdLw@mail.gmail.com>

Hi Jake,

On Wed, 14 Feb 2018, Jacob Keller wrote:

> On Wed, Feb 14, 2018 at 4:53 PM, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Wed, 14 Feb 2018, Psidium Guajava wrote:
> >
> >> On 2018-02-13 18:42 GMT-02:00 Stefan Beller <sbeller@google.com> wrote:
> >> > On Tue, Feb 13, 2018 at 12:22 PM, Psidium Guajava
> >> > <psiidium@gmail.com> wrote: I think this could also be done with
> >> > "git rebase --edit-todo", which brings up the right file in your
> >> > editor.
> >>
> >> Yeah that'd would only work if one started a rebase as a interactive
> >> one, not am or merge.
> >
> > I agree that the original proposal was clearly for the non-interactive
> > rebase (it talked about .git/rebase-apply/).
> >
> > The biggest problem with the feature request is not how useful it
> > would be: I agree it would be useful. The biggest problem is that it
> > is a little bit of an ill-defined problem.
> >
> > Imagine that you are rebasing 30 patches. Now, let's assume that patch
> > #7 causes a merge conflict, and you mistakenly call `git rebase
> > --skip`.
> >
> > Now, when is the next possible time you can call `git rebase
> > --undo-skip`?  It could be after a merge conflict in #8. Or in
> > interactive rebase, after a `pick` that was turned into an `edit`. Or,
> > and this is also entirely possible, after the rebase finished with #30
> > without problems and the rebase is actually no longer in progress.
> >
> > So I do not think that there is a way, in general, to implement this
> > feature. Even if you try to remember the state where a `--skip` was
> > called, you would remember it in the .git/rebase-apply/ (or
> > .git/rebase-merge/) directory, which is cleaned up after the rebase
> > concluded successfully. So even then the information required to
> > implement the feature would not necessarily be there, still, when it
> > would be needed.
> 
> Instead of an "--undo-skip", what if we ask the question of what the
> user actually wants?

Heh, I thought in this instance, --undo-skip was what the user wanted ;-)

> Generally I'd assume that the user wishes to go back to the rebase and
> "pick" the commit back in.

Right, and then replay whatever series of commits was picked since the one
that was skipped.

What *could* be done is to save a copy of the current todo list (with the
skipped commit put back in, before the current first line) and save that
together with `git rev-parse HEAD`.

This should make it possible to implement `--undo-skip` for as long as
the rebase did not finish.

Theoretically, you could even save the commit name of the skipped commit
somewhere else than $GIT_DIR/rebase-apply/ (or $GIT_DIR/rebase-merge/),
say, as worktree-local `refs/rebase/skipped`, and then a `git rebase
--undo-skip` could detect the absence of $GIT_DIR/rebase-*/ and fall back
to `git cherry-pick refs/rebase/skipped`.

You'd have to take pains to handle that ref in gc, and to record when the
user edited the todo list via `git rebase --edit-todo` after skipping that
commit (and warn loudly upon/prevent --undo-skip) because those todo list
changes would then be lost.

That's just one way how this feature could be implemented.

It does strike me as awfully specific, though. And it would still only
extend to the latest `git rebase --skip`.

So I am not sure whether we really would want to go this direction, or
whether we can maybe come up with something (probably based on your
suggestion to give the user enough information) that would allow many more
scenarios than just --undo-skip.

> So what if we just make "git rebase --skip" more verbose so that it
> more clearly spells out which commit is being skipped? Possibly even
> as extra lines of "the following patches were skipped during the
> rebase" after it completes?
> 
> Then it's up to the user to determine what to do with those commits,
> and there are many tools they could use to solve it, "git rebase -i,
> git cherry-pick, git reflog to restore to a previous and re-run the
> rebase, etc".

I think this is a saner direction, as it will probably allow more
scenarios to be addressed than just undoing the latest `git rebase
--skip`.

Ciao,
Dscho

  reply	other threads:[~2018-02-15 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 20:22 git-rebase --undo-skip proposal Psidium Guajava
2018-02-13 20:42 ` Stefan Beller
2018-02-15  0:36   ` Psidium Guajava
2018-02-15  0:53     ` Johannes Schindelin
2018-02-15  1:23       ` Jacob Keller
2018-02-15 13:02         ` Johannes Schindelin [this message]
2018-02-15  1:50       ` Psidium Guajava
2018-02-15  4:50         ` Jacob Keller
2018-02-15 13:06           ` Johannes Schindelin
2018-02-15 10:11   ` Paul Tan

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=nycvar.QRO.7.76.6.1802151308501.35@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=psiidium@gmail.com \
    --cc=pyokagan@gmail.com \
    --cc=sbeller@google.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).