]> git.ipfire.org Git - thirdparty/git.git/commitdiff
submodule update: remove unnecessary orig_flags variable
authorJens Lehmann <Jens.Lehmann@web.de>
Mon, 11 Nov 2013 20:55:52 +0000 (21:55 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Nov 2013 22:10:57 +0000 (14:10 -0800)
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>
git-submodule.sh
t/t7406-submodule-update.sh

index 896f1c9b820b6627da8d591469172d749bf0e700..74cbc53b53cef2e482726e82d547f8425cd073da 100755 (executable)
@@ -706,7 +706,6 @@ cmd_deinit()
 cmd_update()
 {
        # parse $args after "submodule ... update".
-       orig_flags=
        while test $# -ne 0
        do
                case "$1" in
@@ -731,7 +730,6 @@ cmd_update()
                --reference)
                        case "$2" in '') usage ;; esac
                        reference="--reference=$2"
-                       orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                        shift
                        ;;
                --reference=*)
@@ -765,7 +763,6 @@ cmd_update()
                        break
                        ;;
                esac
-               orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                shift
        done
 
@@ -909,7 +906,7 @@ Maybe you want to use 'update --init'?")"
                                prefix="$prefix$sm_path/"
                                clear_local_git_env
                                cd "$sm_path" &&
-                               eval cmd_update "$orig_flags"
+                               eval cmd_update
                        )
                        res=$?
                        if test $res -gt 0
index f0b33053ab01c692a4dda15c0f631aaa45fb81b9..2d9db8e8b7da2c876d65a03811dbb42ea78c2e35 100755 (executable)
@@ -747,6 +747,17 @@ test_expect_success 'submodule update clone shallow submodule' '
         (cd submodule &&
          test 1 = $(git log --oneline | wc -l)
         )
+)
+'
+
+test_expect_success 'submodule update --recursive drops module name before recursing' '
+       (cd super2 &&
+        (cd deeper/submodule/subsubmodule &&
+         git checkout HEAD^
+        ) &&
+        git submodule update --recursive deeper/submodule >actual &&
+        test_i18ngrep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
        )
 '
+
 test_done