Re: [PATCH v5 1/4] submodule: Make 'checkout' update_module explicit

2014-01-26 Thread Eric Sunshine
On Sun, Jan 26, 2014 at 3:45 PM, W. Trevor King wk...@tremily.us wrote:
 This avoids the current awkwardness of having either '' or 'checkout'
 for checkout-mode updates, which makes testing for checkout-mode
 updates (or non-checkout-mode updates) easier.

 Signed-off-by: W. Trevor King wk...@tremily.us
 ---
  git-submodule.sh | 27 +++
  1 file changed, 11 insertions(+), 16 deletions(-)

 diff --git a/git-submodule.sh b/git-submodule.sh
 index 5247f78..5e8776c 100755
 --- a/git-submodule.sh
 +++ b/git-submodule.sh
 @@ -803,17 +803,10 @@ cmd_update()
 update_module=$update
 else
 update_module=$(git config submodule.$name.update)
 -   case $update_module in
 -   '')
 -   ;; # Unset update mode
 -   checkout | rebase | merge | none)
 -   ;; # Known update modes
 -   !*)
 -   ;; # Custom update command
 -   *)
 -   die $(eval_gettext Invalid update mode 
 '$update_module' for submodule '$name')
 -   ;;
 -   esac
 +   if test -z $update_module
 +   then
 +   update_module=checkout

Here, you (unnecessarily) quote 'checkout'...

 +   fi
 fi

 displaypath=$(relative_path $prefix$sm_path)
 @@ -882,11 +875,16 @@ Maybe you want to use 'update --init'?)
 case ;$cloned_modules; in
 *;$name;*)
 # then there is no local change to integrate
 -   update_module= ;;
 +   update_module=checkout ;;

But here you use bare (unquoted) 'checkout'. Bare is probably more idiomatic.

 esac

 must_die_on_failure=
 case $update_module in
 +   checkout)
 +   command=git checkout $subforce -q
 +   die_msg=$(eval_gettext Unable to checkout 
 '\$sha1' in submodule path '\$displaypath')
 +   say_msg=$(eval_gettext Submodule path 
 '\$displaypath': checked out '\$sha1')
 +   ;;
 rebase)
 command=git rebase
 die_msg=$(eval_gettext Unable to rebase 
 '\$sha1' in submodule path '\$displaypath')
 @@ -906,10 +904,7 @@ Maybe you want to use 'update --init'?)
 must_die_on_failure=yes
 ;;
 *)
 -   command=git checkout $subforce -q
 -   die_msg=$(eval_gettext Unable to checkout 
 '\$sha1' in submodule path '\$displaypath')
 -   say_msg=$(eval_gettext Submodule path 
 '\$displaypath': checked out '\$sha1')
 -   ;;
 +   die $(eval_gettext Invalid update mode 
 '$update_module' for submodule '$name')
 esac

 if (clear_local_git_env; cd $sm_path  $command 
 $sha1)
 --
 1.8.5.2.8.g0f6c0d1
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 1/4] submodule: Make 'checkout' update_module explicit

2014-01-26 Thread W. Trevor King
On Sun, Jan 26, 2014 at 08:32:04PM -0500, Eric Sunshine wrote:
 On Sun, Jan 26, 2014 at 3:45 PM, W. Trevor King wk...@tremily.us wrote:
  +   update_module=checkout
 
 Here, you (unnecessarily) quote 'checkout'...
 
  -   update_module= ;;
  +   update_module=checkout ;;
 
 But here you use bare (unquoted) 'checkout'. Bare is probably more
 idiomatic.

Whatever you want ;).  Queued for v6.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature