checkout: reorder option handling
commitb6312c27a06f31625d915d44531d5e728ffd8d63
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 30 Aug 2012 12:45:50 +0000 (30 19:45 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Sep 2012 18:49:31 +0000 (11 11:49 -0700)
treed19ceaa82ba5ff322fa5495951e2ad04c395a30e
parente51e30577a9056f5ae7195c694a00ee71200a9d5
checkout: reorder option handling

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
   determining mode

 - Code of each mode is in checkout_paths() and checkout_branch(),
   where sanity checks are performed

Another slight improvement is always print branch name (or commit
name) when printing errors related ot them. This helps catch the case
where an option is mistaken as branch/commit.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c