All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Christian Couder <chriscool@tuxfamily.org>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH 7/7] sequencer: Remove sequencer state after final commit
Date: Mon, 15 Aug 2011 11:55:23 -0700	[thread overview]
Message-ID: <7v7h6eld2c.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vippzlj7a.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Sun, 14 Aug 2011 15:30:33 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> I believe it is meant to support command sequences such as these:
>>
>> 1.
>> 	git cherry-pick foo; # has conflicts
>> 	... resolve conflicts and "git add" the resolved files ...
>> 	git commit
>> 	git cherry-pick bar
>
> Why does a single commit "cherry-pick foo" leave any sequencer state that
> may interfere with the latter to begin with? Isn't that already a bug?
>
>> 2.
>> 	git cherry-pick foo bar; # has conflicts applying "bar"
>> 	... resolve ...
>> 	git commit
>> 	git cherry-pick baz
>>
>> Those were intuitive things to do before the sequencer existed, and if
>> I understand correctly, d3f4628e was intended to support people and
>> scripts (such as the test suite) that have these commands wired into
>> their fingers.
>
> Given that the latter was broken when "foo" stopped with conficts (it lost
> "bar" altogether anyway), I am not worried about it, and I do not care
> much about anybody who had wired such multi-pick into scripts or fingers,
> either.
>
> IOW, I do not necessarily agree with your "those were intuitive"
> assertion.

After sleeping on this, here are my random thoughts on this topic.

 - The sequencing flow the current "rebase -i" implements when resuming a
   controlled stop (i.e. "edit" or "reword"), even as the last step of the
   insn sheet, feels like the right thing. The actual tweaking of the
   commit done by "commit --amend" is oblivious to the sequencing state,
   and resuming is controlled by "rebase --continue".

 - The case to resume an unexpected stop (i.e. "pick" that causes conflict
   or "rebase" without "-i") also feels right. The user fixes up and marks
   things as "done" with "add/rm", and tell the stopped command that it can
   now continue with "rebase --continue". The same comment applies for
   "am".

 - Even before we started talking about the sequencer, the workflow to deal
   with conflicted "revert" or "cherry-pick" was awkward. From the end
   user's point of view, the operation the end user wanted to perform was
   "revert" (or "cherry-pick"), but we tell the user to fix things up, mark
   them as "done" with "add/rm", and commit the result themselves. We could
   have made the UI more consistent by introducing "revert --continue".

 - In a sense, the last point got worse by a recent change to make
   "commit" notice CHERRY_PICK_HEAD. This was modeled the workflow to
   conclude a conflicted "merge", that noticed "MERGE_HEAD" etc., but from
   the UI point of view, I think it was a mistake. Back when "merge" was
   the only command that needs post-clean-up by the user, saying "when
   merge stops due to conflict, you conclude it with commit, but
   everything else you conclude (or continue) with --continue" was
   reasonable, but now we have to say "after conflicted merge, revert and
   cherry-pick, you conclude it with commit; use --continue for everything
   else".

So I think that questions that affect us longer term are:

 - Does it make sense to keep this two quite different ways to resume an
   interrupted operation? Some saying "The operation you started was Foo
   but you need to conclude it with 'commit'", others saying "When Bar
   stops in the middle, you say 'Bar --continue'"?

 - If so, which camp should the sequencer-based commands fall into?

 - If not, shouldn't we be unifying the user experience to one of them,
   with backward compatibility escape hatches?

I think what d3f4628e tried to do may make sense _if_ we want to make
"commit" the way to conclude or continue sequencer-based commands. If we
really wanted to go that route, however, it would make it easier if
"commit" were the _only_ way to deal with all the "stopped because the
user needs to resolve conflicts or because the user told us to pause"
situations. For example, when "rebase -i" stops (either due to an "edit"
or a conflicted "pick"), after the user tweaks the tree and says "git
commit [--amend]" to reword, "rebase --continue" after that shouldn't be
necessary. If we are making "commit" aware of the sequencer status, it
should already know that the next thing after that invocation of "commit"
is to resume the sequencing.

But I do not think that is the direction we would want to go for two
reasons. There is a (complicated) workflow to split an commit during
"rebase -i" that does _not_ want an auto-resume by a commit. Also not
all conflicted/stopped state can be concluded with "commit" (think:
"rebase/am --skip").

I personally am leaning towards teaching "--continue" to "merge" and
"cherry-pick", while keeping only existing awareness of these two commands
in "commit" as historical mistakes (look for 'unlink(git_path("[A-Z_]*"))'
in builtin/commit.c). That would mean that in the long run, new users need
to learn only one thing: when "git Foo" stops because it needs help from
you resolving conflicts, after you help it by editing the files in your
working tree and making that with add/rm, you say "git Foo --continue" to
signal that you are done helping it.

And we do not have to worry about making "commit" only half-aware of
sequencer states.

  reply	other threads:[~2011-08-15 18:55 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14  8:33 [PATCH v2 0/7] Generalized sequencer foundations Ramkumar Ramachandra
2011-08-14  8:33 ` [PATCH 1/7] revert: Free memory after get_message call Ramkumar Ramachandra
2011-08-14 16:15   ` Jonathan Nieder
2011-08-14  8:33 ` [PATCH 2/7] revert: Fix buffer overflow in insn sheet parser Ramkumar Ramachandra
2011-08-14 11:58   ` Jonathan Nieder
2011-08-14 14:07     ` Ramkumar Ramachandra
2011-08-14  8:33 ` [PATCH 3/7] revert: Make commit descriptions in insn sheet optional Ramkumar Ramachandra
2011-08-14 16:09   ` Jonathan Nieder
2011-08-14 16:21     ` Ramkumar Ramachandra
2011-08-14  8:33 ` [PATCH 4/7] revert: Allow mixed pick and revert instructions Ramkumar Ramachandra
2011-08-14 12:12   ` Jonathan Nieder
2011-08-14 14:06     ` Ramkumar Ramachandra
2011-08-14 14:28       ` Jonathan Nieder
2011-08-14  8:33 ` [PATCH 5/7] revert: Make the argument parser responsible for setup_revisions Ramkumar Ramachandra
2011-08-14 12:52   ` Jonathan Nieder
2011-08-14 13:43     ` Ramkumar Ramachandra
2011-08-14  8:33 ` [PATCH 6/7] sequencer: Expose API to cherry-picking machinery Ramkumar Ramachandra
2011-08-14 13:13   ` Jonathan Nieder
2011-08-14 13:57     ` Ramkumar Ramachandra
2011-08-14 15:22       ` Jonathan Nieder
2011-08-16 17:51         ` Junio C Hamano
2011-08-16 18:16           ` [PATCH v2] revert: plug memory leak in "cherry-pick root commit" codepath Jonathan Nieder
2011-08-16 18:27             ` Jonathan Nieder
2011-08-16 18:31             ` Jeff King
2011-08-16 18:56               ` Jonathan Nieder
2011-08-14  8:33 ` [PATCH 7/7] sequencer: Remove sequencer state after final commit Ramkumar Ramachandra
2011-08-14 16:04   ` Jonathan Nieder
2011-08-14 16:37     ` Ramkumar Ramachandra
2011-08-14 16:48       ` Jonathan Nieder
2011-08-14 21:13     ` Junio C Hamano
2011-08-14 21:32       ` Jonathan Nieder
2011-08-14 22:30         ` Junio C Hamano
2011-08-15 18:55           ` Junio C Hamano [this message]
2011-08-17 20:23             ` Ramkumar Ramachandra
2011-08-18 18:51             ` Ramkumar Ramachandra
2011-08-18 19:18               ` Jonathan Nieder
2011-08-18 19:50                 ` Ramkumar Ramachandra
2011-08-18 20:05                   ` Jonathan Nieder
2011-08-18 20:06                   ` Ramkumar Ramachandra
2011-08-18 20:12                     ` Jonathan Nieder
2011-08-18 20:22                   ` Junio C Hamano
2011-08-18 20:42                 ` Junio C Hamano
2011-08-19  9:08                   ` Ramkumar Ramachandra

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=7v7h6eld2c.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /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.