git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Victor Toni <victor.toni@gmail.com>, git@vger.kernel.org
Subject: Re: Aborting git rebase --edit-todo
Date: Fri, 4 Sep 2020 07:32:11 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.2009040729010.56@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <xmqqa6y6ah8h.fsf@gitster.c.googlers.com>

Hi Junio & Victor,

On Thu, 3 Sep 2020, Junio C Hamano wrote:

> Victor Toni <victor.toni@gmail.com> writes:
>
> > When doing a commit or choosing what to do for an interactive rebase
> > one can just wipe the whole content of the editor, save and close to
> > abort the action.
> > While doing a `git rebase --edit-todo` I came to the conclusion that I
> > would like to abort the edit and did the same. The final `git rebase
> > --continue` got me rid of the rest of the commits...
> > (Fortunately the "missing" commits could be rescued by looking into
> > `.git/logs/HEAD` so thumbs up for that. )
> > Unfortunately the behaviour of `--edit-todo` was a bit surprising and
> > somehow doesn't feel consistent with the other actions involving an
> > editor.
> >
> > Can this be considered a bug?
>
> It is rather unusual (or almost always wrong) to have a totally
> empty commit log or initial todo list, so it is understandable for
> Git in these situations to stop without doing anything further.
>
> There is no other sensible interpretations of what you are telling
> Git to you by returning an empty buffer---it is extremely unlikely
> you want to create a commit with no log message (without explicitly
> allowing it with --allow-empty-message, the command is likely to
> fail anyway), and it is extremely unlikely that you wanted to just
> reset the tip of the branch to the --onto commit.
>
> Once an interactive rebase session has started and you are given the
> remainder of the steps to edit and you give an empty buffer back,
> however, there are two possible interpretations that are equally
> sensible, I would think.
>
>  - One is that you are signaling that you are done with the rebase
>    session and all the remaining commits are to be discarded.
>
>  - The other is that you botched editing the todo list, and you wish
>    Git to give you another chance to edit it again.
>
> I think the implementor chose the first interpretation.  The "drop"
> insn is a relatively recent invention, and back when it was missing
> from the vocabulary, I do not think it was possible to say " discard
> all the rest" without emptying the todo list, so that design is
> understandable.
>
> Now we have the "drop" verb, the latter interpretation becomes
> possible without making it impossible for the user to express the
> former.  It might be a good idea to
>
>  (1) save away the original before allowing --edit-todo to edit,
>
>  (2) open the editor, and
>
>  (3) when getting an empty buffer back, go back to step (2) using
>      the back-up made in step (1).
>
> Either way, the todo list editor buffer can have additional comment
> instructing what happens when the buffer is emptied.
>
> I have no strong opinion on this one myself.  Deferring to Dscho,
> who may have a lot more to say on the design issue around this
> feature than I do.

First of all, some historical background: the idea that deleting
everything in the todo list aborts the rebase *predates* `git rebase
--edit-todo` by quite a bit, in fact, that idea was implemented in either
the very first version of `git rebase -i` or at least very, very short
thereafter.

This idea came from the fact that deleting the commit message would abort
a `git commit`.

In the meantime, `--edit-todo` is a thing (where this behavior makes a lot
less sense), and `drop` is also a thing.

I agree that it may be a good time to deprecate that behavior, after
introducing a new verb `abort` or something like that.

Ciao,
Dscho

      parent reply	other threads:[~2020-09-04 13:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  9:39 Aborting git rebase --edit-todo Victor Toni
2020-09-03 17:43 ` Junio C Hamano
2020-09-03 18:55   ` Carlo Arenas
2020-09-03 19:22     ` Victor Toni
2020-09-03 20:02       ` Junio C Hamano
2020-09-03 19:32   ` Victor Toni
2020-09-03 19:59     ` Carlo Arenas
2020-09-03 21:07       ` Victor Toni
2020-09-03 21:08     ` Junio C Hamano
2020-09-03 21:21       ` Victor Toni
2020-09-04  5:43         ` Johannes Schindelin
2020-09-06 21:52         ` Junio C Hamano
2020-09-04  5:42     ` Johannes Schindelin
2020-09-04  5:32   ` Johannes Schindelin [this message]

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.2009040729010.56@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=victor.toni@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).