From: Karthik Nayak Date: Tue, 01 Sep 2026 14:14:42 GMT Subject: Re: [PATCH v2 6/8] checkout: restructure switch, restore, and checkout entrypoints Message-ID: In-Reply-To: <20260830204835.1040408-7-gitster@pobox.com> Junio C Hamano writes: > cmd_switch(), cmd_restore(), and cmd_checkout() pass their options > to checkout_main(), which parses options and configuration, > validates and dispatches to checkout_branch() or checkout_paths(). > > Now that option initialization, validation, and branch setup have been > split into dedicated helper functions, restructure cmd_switch(), > cmd_restore(), and cmd_checkout() to invoke these helpers directly and > dispatch to checkout_branch() or checkout_paths(). > > In cmd_restore(), handle the --staged default from_treeish = "HEAD" and > resolve opts.from_treeish into new_branch_info and opts.source_tree. > > This allows us to remove checkout_main() and enum checkout_command > as they are no longer needed. > > Signed-off-by: Junio C Hamano > --- > builtin/checkout.c | 297 +++++++++++++++++++++++---------------------- > 1 file changed, 149 insertions(+), 148 deletions(-) > > diff --git a/builtin/checkout.c b/builtin/checkout.c > index 2edaca5539..b18515ac7f 100644 > --- a/builtin/checkout.c > +++ b/builtin/checkout.c > @@ -1341,12 +1341,6 @@ static void setup_new_branch_info_and_source_tree( > } > > > -enum checkout_command { > - CHECKOUT_CHECKOUT = 1, > - CHECKOUT_SWITCH = 2, > - CHECKOUT_RESTORE = 3, > -}; > - Okay so this is how the first commit fits in. Now it makes sense. [snip]