Subject: Re: [PATCH 10/17] sequencer: Announce sequencer state location

From: Jonathan Nieder <[email-masked]>
Date: Tue, 12 Jul 2011 13:56:38 -0500

Ramkumar Ramachandra wrote:

> The plan to build a generic sequencer involves fist writing the
> functionality into builtin/revert.c (for cherry-pick and revert), and
> then factoring it out into sequencer.c and exposing it through
> sequencer.h as a nice API.  As a prelude to this, announce the
> location of the sequencer state in sequencer.h and write a function to
> remove it.

Wait, so what is the actual impact of this patch?

As far as I can tell, it is to introduce a remove_sequencer_state()
function whose eventual purpose would be to remove the .git/sequencer
directory used by "git cherry-pick" to record its progress.  Paraphrased,
the function does this:

	rm -fr "$GIT_DIR/sequencer-old"
	mv "$GIT_DIR/sequencer" "$GIT_DIR/sequencer-old"

This way, a person has one level of "undo" possible, assuming git
commands and scripts use the function carefully enough not to call it
twice.

Is the "undo" feature advertised anywhere?  Should this function write
a message to stderr to inform the operator about how to get back the
precious cherry-pick state?

If I were doing it, I'd squash this with the patch that introduces
"git cherry-pick --quit", to give an example of how the new function is
meant to be used (and tests!).

> --- /dev/null
> +++ b/sequencer.h
> @@ -0,0 +1,14 @@
[...]
> +/* Removes SEQ_OLD_DIR and renames SEQ_DIR to SEQ_OLD_DIR, ignoring
> + * any errors.  Intended to be used by 'git reset --hard'.
> + */
> +void remove_sequencer_state(void);

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=scripts/checkpatch.pl