Re: [PATCH] rebase -i: restore autostash on abort
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Jun 28, 2016, 20:42 UTC
- Message-ID
- <vpqvb0tqc46.fsf@anie.imag.fr>
- In-Reply-To
- <xmqqa8i587cx.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > >> +test_expect_success 'restore autostash on editor failure' ' >> + test_when_finished "git reset --hard" && >> + echo uncommited-content >file0 && >> + ( >> + test_set_editor "false" && >> + test_must_fail git rebase -i --autostash HEAD^ >> + ) && >> + echo uncommited-content >expected && > > While making sure this case works is crucial, it is not an > interesting failure mode, is it? Can we also have "does not apply > cleanly anymore" case, too?
It is "interesting" if you mean "matches real-life use-case", as it corresponds to the case where the user killed the editor (as reported by Daniel Hahler indeed, "Abort with ":cq", which will make Vim exit non-zero").
If you mean "likely to trigger nasty bugs", then indeed testing the case when apply_autostash fails is interesting: for example, calling die_abort when "stash apply" fails is tempting, but would lead to infinite recursion (it doesn't seem to be the case, but a test would be nice). Setting the editor to something that modifies uncommited-content before 'false' should do the trick.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/