Re: [PATCH v3] stash: avoid recursive hard reset on submodules
On Sat, Oct 12, 2019 at 10:46:36AM +0900, Junio C Hamano wrote:
Show 20 quoted lines
> > + git init sub &&
> > + (
> > + cd sub &&
> > + test_commit sub_file
> > + ) &&
> > + git init main &&
> > + (
> > + cd main &&
> > + git submodule add ../sub &&
> > + test_commit main_file
> > + ) &&
> > + test_when_finished "rm -rf main sub"
>
> Have test_when_finished that removes main and sub _before_ you start
> creating sub and main.
>
> When the &&-cascade breaks anywhere, the control may not even reach
> your test_when_finished that registers the clean-up procedure.
> Imagine "git init sub" succeeds but "git init main" somehow
> fails---you still want to clean up "sub".
Ah, of course, will fix this (and the other point as well).
> Other than that, looks reasonably well done.
Thanks. This was fun to figure out and fix.