From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DB923D16EF for ; Tue, 1 Sep 2026 23:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.146 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788305152; cv=none; b=X0H5qTVL/jdsBeajb6Hd5JEA6MhSAXIXOXx4+uwEoNaTPxQGQ7MuT2wDUyjzol8F8ugm1it4K72GZP1AOwL7CZUq6r2W748KSyQTnIpCcT5M+XOdZ0xZ9R4xZiZ9FZF0fCfSR8S3h/CSGBm4IaSTF8SM4o9gyDE9zzCuHckHRt0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788305152; c=relaxed/simple; bh=pocjikOK31jQ3wpVl1JsSIwZHJ8YfFPe94Mgji+tgBQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=L05KvCWbfpXI4j1jLOJjFPSBJXVMr445zuWWq253GwLPN5dhpnpHcG6dnyS6KoQgnBM1/18t0fHUVw+XT94K9RFVYYRr+aR4+tS0i4MgYceGtELk/IOwi++dma9xNJ9eklwi5yWOJMXMj3ryaoq4eBb1mIDdTcVk8jVucHpB9YI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=q/Eudkgy; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Kq9W0M7G; arc=none smtp.client-ip=202.12.124.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="q/Eudkgy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Kq9W0M7G" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 715D21D000A6; Tue, 1 Sep 2026 19:25:50 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-02.internal (MEProxy); Tue, 01 Sep 2026 19:25:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1788305150; x=1788391550; bh=CIAG5bIVgN vw4kWhJ6pSnFhvsCGXgBBIvGRnBKqIUpw=; b=q/Eudkgy4x6PgZUGqaxk1vxjKO sh/qTm8B1hHjE0x2wGprrUMhUvtOuGvlj5id9VWfTo5XaJfUA9ypPUZYpTRs5wwm ske8BHmR3WsrELTUICK8Xu57wAmZ9QcOgW8vkCOIBGgZeTOfCL/T7qmENUxoU6sE 3hWoSLTXLW4DDkxAWVVGkFssgq5L7+A0BPZkOHHFuV8dn8ydjToVVymA6aFEFWk0 KWJymhLhlULzlBpmIBcE4X7fuLH5EP19QeK26el55cei41dFpHMUmOOjCghlteIW xs+HeZMJaJdcK0jG66wnxSHK4E9Oo0G7CpYIcGNzSofioJmtb9Tf1EyOfKhA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1788305150; x=1788391550; bh=CIAG5bIVgNvw4k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b1x+L/7z9bll+nzSZZVikHbDRuR+6w3fvCvfOhnVtYJ2sWjuG8Zv+fA X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Sep 2026 19:25:49 -0400 (EDT) From: Junio C Hamano To: Karthik Nayak Cc: git@vger.kernel.org Subject: Re: [PATCH v2 6/8] checkout: restructure switch, restore, and checkout entrypoints In-Reply-To: (Karthik Nayak's message of "Tue, 1 Sep 2026 07:14:42 -0700") References: <20260828225206.310500-1-gitster@pobox.com> <20260830204835.1040408-1-gitster@pobox.com> <20260830204835.1040408-7-gitster@pobox.com> Date: Tue, 01 Sep 2026 16:25:48 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Karthik Nayak writes: > 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. Yes. The point of the series was to get rid of the monolithic checkout_main() that everybody goes through. And the enum is primarily for that monolith to decide which code path the original request is about. In the step that gets rid of the monolith, the enum no longer becomes needed, even though an error message with advice to tell which options are mutually incompatible may need to know the exact name of the option. That makes [1/8] more reasonable than passing enums around.