sequencer: make sequencer abort safer
commit1e41229d962b43208e6bf79e729b400c31697cc9
authorStephan Beyer <s-beyer@gmx.net>
Wed, 7 Dec 2016 21:51:32 +0000 (7 22:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Dec 2016 22:50:45 +0000 (9 14:50 -0800)
tree4c9a5b2eb4277ca20791331e60bdfd65a78134a6
parentaeebd98ebe0fbd61f517d9da04f914c37ea0066b
sequencer: make sequencer abort safer

In contrast to "git am --abort", a sequencer abort did not check
whether the current HEAD is the one that is expected. This can lead
to loss of work (when not spotted and resolved using reflog before
the garbage collector chimes in).

This behavior is now changed by mimicking "git am --abort".  The
abortion is done but HEAD is not changed when the current HEAD is
not the expected HEAD.

A new file "sequencer/abort-safety" is added to save the expected
HEAD.

The new behavior is only active when --abort is invoked on multiple
picks. The problem does not occur for the single-pick case because
it is handled differently.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3510-cherry-pick-sequence.sh