Subject: Re: [PATCH 0/8] Sequencer Foundations

From: Jonathan Nieder <[email-masked]>
Date: Wed, 11 May 2011 08:14:26 -0500

Ramkumar Ramachandra wrote:

> I've not attempted to add anything new in this series -- It merely
> fixes all the mistakes in the previous iteration.  I've tried to
> integrate the improvements suggested by all the previous reviews.

Thanks!  This is much more readable, probably because of the commit
messages. ;-)

> All tests pass in all patches, and I hope no
> stray lines have travelled b/w the patches during the rebase.

Speaking of which, some tests and documentation would be nice as icing
on the cake.

> Ramkumar Ramachandra (8):
>   revert: Improve error handling by cascading errors upwards
>   revert: Make "commit" and "me" local variables
>   revert: Introduce a struct to parse command-line options into
>   revert: Separate cmdline argument handling from the functional code
>   revert: Catch incompatible command-line options early
>   revert: Introduce head, todo, done files to persist state
>   revert: Implement parsing --continue, --abort and --skip
>   revert: Implement --abort processing

The heart is patch 6/8.  I have not thought about this deeply yet, but
I wonder if it would be simpler if the behavior of "git cherry-pick
1..10" looked like this:

. if there is state in .git/sequencer already, error out
. lock .git/sequencer/head with the lockfile API to prevent
  concurrent access
. write current state, including remaining commits to cherry-pick
. unlock .git/sequencer/head
. cherry-pick commit #1
. lock sequencer, check state, update state, unlock
. cherry-pick commit #2
 ...

This way, even if cherry-picking causes git to segfault, the sequencer
state is in good order and we know where to pick up.  More
importantly, massive refactoring of the merge_recursive API would not
be needed to keep everything in working order.  An atexit and sigchain
handler could be added to print advice for the reader about how to
resume, but that's just an extra hint and it's okay if it sometimes
doesn't happen sometimes.

What do you think?

Ciao,
Jonathan