submodule update: remove unnecessary orig_flags variable

cmd_update() in the submodule script tries to preserve the options given on the command line in the "orig_flags" variable to pass them on into the recursion when the '--recursive' option is given. But this isn't necessary because all the variables set by the options will be seen in the recursion too as that is achieved by executing "eval cmd_update". The same has already been done for cmd_status() in e15bec0ec, so let's clean up cmd_update() likewise. Also add a test to make sure that a submodule name given on the command line is not passed into the recursion (which was the goal of adding the orig_flags variable in 98dbe63db). Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Nov 11, 2013 at 21:55 UTC 361412828ab580e145c3350cf075b283ebe331a5
2 files changed +12 -4
git-submodule.sh
+1 -4
@@ -706,7 +706,6 @@ cmd_deinit()
706 cmd_update()
707 {
708 # parse $args after "submodule ... update".
709 - orig_flags=
709 while test $# -ne 0
710 do
711 case "$1" in
@@ -731,7 +730,6 @@ cmd_update()
730 --reference)
731 case "$2" in '') usage ;; esac
732 reference="--reference=$2"
734 - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
733 shift
734 ;;
735 --reference=*)
@@ -765,7 +763,6 @@ cmd_update()
763 break
764 ;;
765 esac
768 - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
766 shift
767 done
768
@@ -909,7 +906,7 @@ Maybe you want to use 'update --init'?")"
906 prefix="$prefix$sm_path/"
907 clear_local_git_env
908 cd "$sm_path" &&
912 - eval cmd_update "$orig_flags"
909 + eval cmd_update
910 )
911 res=$?
912 if test $res -gt 0
t/t7406-submodule-update.sh
+11
@@ -747,6 +747,17 @@ test_expect_success 'submodule update clone shallow submodule' '
747 (cd submodule &&
748 test 1 = $(git log --oneline | wc -l)
749 )
750 +)
751 +'
752 +
753 +test_expect_success 'submodule update --recursive drops module name before recursing' '
754 + (cd super2 &&
755 + (cd deeper/submodule/subsubmodule &&
756 + git checkout HEAD^
757 + ) &&
758 + git submodule update --recursive deeper/submodule >actual &&
759 + test_i18ngrep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
760 )
761 '
762 +
763 test_done