From: Eric Sunshine Date: Tue, 28 Nov 2017 06:02:36 GMT Subject: Re: [RFC PATCH v2] builtin/worktree: enhance worktree removal Message-ID: In-Reply-To: On Mon, Nov 27, 2017 at 11:04 PM, Junio C Hamano wrote: > Eric Sunshine 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.