Re: [PATCH v2 3/3] checkout: reorder option handling

2012-08-29 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > + if (opts.patch_mode || opts.pathspec) > + return cmd_checkout_entry(&opts, &new); > + else > + return cmd_switch(&opts, &new); > } Yeah, patch_mode is really part of checking out paths, so separating the actions into two makes se

Re: [PATCH v2 3/3] checkout: reorder option handling

2012-08-29 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > I'm not entirely sure about this chunk > > +if (opts->track != BRANCH_TRACK_UNSPECIFIED) { > +if (opts->new_orphan_branch) > +die(_("%s cannot be used with %s"), "--orphan", "-t"); > +if (opts->force_detach) > +

[PATCH v2 3/3] checkout: reorder option handling

2012-08-29 Thread Nguyễn Thái Ngọc Duy
checkout operates in three different modes. On top of that it tries to be smart by guessing the branch name for switching. This results in messy option handling code. This patch reorders it so that - cmd_checkout() is responsible for parsing, preparing input and determinining mode - Code of