git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/7] sequencer: Remove sequencer state after final commit

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Aug 18, 2011, 18:51 UTC
Message-ID
<CALkWK0noHBnW-7zZLw=jJdDVFxXmsm2vHHYnUJc9miLLuDRnAg@mail.gmail.com>
In-Reply-To
<7v7h6eld2c.fsf@alter.siamese.dyndns.org>
Hi Junio,
Junio C Hamano writes:
> [...]

Here are some comments from my end after extensive thought. Instead of responding to your comments directly, I've sprinkled bits of it here and there, reordering it as I see fit. Thanks for detailing out your thoughts so well :)

0. Before getting into historical mistakes and evaluating existing
workflows, let's first try to detail the problem the sequencer is
trying to solve: pick/ revert aren't the only operations we want to
support.  Let's imagine some hypothetical "foo" operation that does
something incredibly complex in the instruction sheet:

pick b38bcc foo pick 49ab7c

Now, let's imagine that the "foo" command failed.  What is the
strategy we will employ to handle his?  I think the question boils
down to: should we teach '--continue' the prerequisite for executing a
"pick" command (clean worktree etc), or how to finish a "foo" command?
 What will this answer depend upon?
1. Now, let's discuss the motivation for d3f4628e.  I didn't want to
create a separate workflow for pick-one-commit versus
pick-many-commits.  It would have to go something like:
  parse_arguments(whatever tree'ishes specified on argc)
  setup_revision_walker
  n = count_revisions
  if (n == 1)
    do foo; // Don't create sequencer state
  else
    create sequencer state; do foo; cleanup sequencer state;

Ugly. Wouldn't you agree? So, what choice did I have? I can't conditionally create sequencer state. So, an idea struck me: if I clean it up before someone notices, I'm safe. So, I decided to remove it before the last commit -- when there's only one commit, it'll be removed immediately. So far so good: no regressions introduced.

2.  Okay, now let's try to touch upon the issue of marking something as "done":
Show 5 quoted lines
>  - 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".

I could argue that "add/rm" need not be the only way to specify "done" in the general case. We needn't be consistent about that- we can print hints about what "done" would mean, and not invent a new "--mark-as-done" command. What varies here is the definition of "done": does it mean that the user has "done" what the instruction sheet operation was supposed to do (including the committing), or has simply done a part of the job and passed on the baton?

3. How tight do we want the sequencer to be?  Should we allow
executing other commands during the operation of the sequencer, or
should we simply expect the user to "--continue" the operation first
and take care of everything else later?
Show 5 quoted lines
>  - 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".

I often "git commit -m temp" in the middle of a "rebase -i", and I'm strongly in favor of allowing this somehow.

> There is a (complicated) workflow to split an commit during
> "rebase -i" that does _not_ want an auto-resume by a commit.

Exactly! :) Auto-resuming after a "commit" is fundamentally wrong.

> Also not
> all conflicted/stopped state can be concluded with "commit" (think:
> "rebase/am --skip").
A good point on consistency.
4.  Let's correct the historical mistakes and get our act together.
The final pending question is: how many historical mistakes are we
willing to stomp now?
Show 8 quoted lines
> 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.
Okay, stomp nothing.  Under this constraint, the best we can do is:
1. Introduce a 'merge --continue' to invoke 'git commit'.  MERGE_HEAD
helps 'git commit' finish.  Modify tests to use '--continue' instead
of the earlier commit-to-finish workflow, and advertise this feature
everywhere.
2. Make 'cherry-pick --continue' invoke 'git commit' as well.
CHERRY_PICK_HEAD helps 'git commit' finish.  If the commit finishes
successfully: (if there is one commit left, remove the sequencer
state; otherwise, drop the first insn on top of the list and execute
the next insn).  Modify tests to use '--continue' instead of the
earlier commit-to-finish workflow, and advertise this feature
everywhere.  Unfortunately, if the user executes 'git commit' instead
of the newer '--continue', we're screwed: a stray sequencer state will
be left behind.

Does the above seem sensible, or should we do something about the historical mistakes?

Thanks.
-- Ram
Previous: Ramkumar RamachandraNext: Jonathan Nieder
Message 35 of 43 in “Generalized sequencer foundations”
  1. 0/7 Generalized sequencer foundationsRamkumar Ramachandra, Aug 14, 2011
  2. 1/7 revert: Free memory after get_message callRamkumar Ramachandra, Aug 14, 2011
  3. Jonathan NiederAug 14, 2011
  4. 2/7 revert: Fix buffer overflow in insn sheet parserRamkumar Ramachandra, Aug 14, 2011
  5. Jonathan NiederAug 14, 2011
  6. Ramkumar RamachandraAug 14, 2011
  7. 3/7 revert: Make commit descriptions in insn sheet optionalRamkumar Ramachandra, Aug 14, 2011
  8. Jonathan NiederAug 14, 2011
  9. Ramkumar RamachandraAug 14, 2011
  10. 4/7 revert: Allow mixed pick and revert instructionsRamkumar Ramachandra, Aug 14, 2011
  11. Jonathan NiederAug 14, 2011
  12. Ramkumar RamachandraAug 14, 2011
  13. Jonathan NiederAug 14, 2011
  14. 5/7 revert: Make the argument parser responsible for setup_revisionsRamkumar Ramachandra, Aug 14, 2011
  15. Jonathan NiederAug 14, 2011
  16. Ramkumar RamachandraAug 14, 2011
  17. 6/7 sequencer: Expose API to cherry-picking machineryRamkumar Ramachandra, Aug 14, 2011
  18. Jonathan NiederAug 14, 2011
  19. Ramkumar RamachandraAug 14, 2011
  20. Jonathan NiederAug 14, 2011
  21. Junio C HamanoAug 16, 2011
  22. revert: plug memory leak in "cherry-pick root commit" codepathJonathan Nieder, Aug 16, 2011
  23. Jonathan NiederAug 16, 2011
  24. Jeff KingAug 16, 2011
  25. Jonathan NiederAug 16, 2011
  26. 7/7 sequencer: Remove sequencer state after final commitRamkumar Ramachandra, Aug 14, 2011
  27. Jonathan NiederAug 14, 2011
  28. Ramkumar RamachandraAug 14, 2011
  29. Jonathan NiederAug 14, 2011
  30. Junio C HamanoAug 14, 2011
  31. Jonathan NiederAug 14, 2011
  32. Junio C HamanoAug 14, 2011
  33. Junio C HamanoAug 15, 2011
  34. Ramkumar RamachandraAug 17, 2011
  35. Ramkumar RamachandraAug 18, 2011
  36. Jonathan NiederAug 18, 2011
  37. Ramkumar RamachandraAug 18, 2011
  38. Jonathan NiederAug 18, 2011
  39. Ramkumar RamachandraAug 18, 2011
  40. Jonathan NiederAug 18, 2011
  41. Junio C HamanoAug 18, 2011
  42. Junio C HamanoAug 18, 2011
  43. Ramkumar RamachandraAug 19, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.