Re: [RFC PATCH v2] builtin/worktree: enhance worktree removal
On Mon, Nov 27, 2017 at 11:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 23 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> 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.