On Mon, Nov 27, 2017 at 11:04 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: >> I had envisioned a simple 'goto remove_control_info' rather than extra >> nesting or refactoring, but that's a minor point. > > Yes, use of goto is also a good way to avoid having to worry about > the future evolution of the codeflow in this function. > > So perhaps > > if (the directory is no longer there) > goto cleanup; > if (the worktree does not validate) > return -1; > ... the original code to (carefully) remove the > ... worktree itself > > cleanup: > > ... remove control info > ... free resources held in variables > ... return from the function > > is what we want? Yes, that's what I had in mind.