Re: [PATCH v2 6/8] checkout: restructure switch, restore, and checkout entrypoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




Junio C Hamano <gitster@xxxxxxxxx> writes:
> Karthik Nayak <karthik.188@xxxxxxxxx> writes:
>
>> Junio C Hamano <gitster@xxxxxxxxx> 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 <gitster@xxxxxxxxx>
>>> ---
>>> 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.
Yeah. It makes sense, in isolation [1/8] looked odd, but together it
fits.

Attachment: signature.asc
Description: PGP signature


[Index of Archives] [Linux Kernel Development] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [Fedora Users]

(追記) (追記ここまで)
Powered by Linux

AltStyle によって変換されたページ (->オリジナル) /