{"thread":{"id":"35319","subject":"[PATCH] submodule update: remove unnecessary orig_flags variable","startedAt":"2013-11-11T20:55:52Z","lastAt":"2013-11-11T20:55:52Z","messageCount":1,"participants":["Jens Lehmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"230433","messageId":"52814458.8090004@web.de","threadId":"35319","inReplyTo":null,"subject":"[PATCH] submodule update: remove unnecessary orig_flags variable","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-11-11T20:55:52Z","receivedAt":"2013-11-11T20:55:52Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"cmd_update() in the submodule script tries to preserve the options given\non the command line in the \"orig_flags\" variable to pass them on into the\nrecursion when the '--recursive' option is given. But this isn't necessary\nbecause all the variables set by the options will be seen in the recursion\ntoo as that is achieved by executing \"eval cmd_update\".\n\nThe same has already been done for cmd_status() in e15bec0ec, so let's\nclean up cmd_update() likewise. Also add a test to make sure that a\nsubmodule name given on the command line is not passed into the recursion\n(which was the goal of adding the orig_flags variable in 98dbe63db).\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-submodule.sh            |  5 +----\n t/t7406-submodule-update.sh | 11 +++++++++++\n 2 files changed, 12 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 896f1c9..74cbc53 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -706,7 +706,6 @@ cmd_deinit()\n cmd_update()\n {\n \t# parse $args after \"submodule ... update\".\n-\torig_flags=\n \twhile test $# -ne 0\n \tdo\n \t\tcase \"$1\" in\n@@ -731,7 +730,6 @@ cmd_update()\n \t\t--reference)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\treference=\"--reference=$2\"\n-\t\t\torig_flags=\"$orig_flags $(git rev-parse --sq-quote \"$1\")\"\n \t\t\tshift\n \t\t\t;;\n \t\t--reference=*)\n@@ -765,7 +763,6 @@ cmd_update()\n \t\t\tbreak\n \t\t\t;;\n \t\tesac\n-\t\torig_flags=\"$orig_flags $(git rev-parse --sq-quote \"$1\")\"\n \t\tshift\n \tdone\n\n@@ -909,7 +906,7 @@ Maybe you want to use 'update --init'?\")\"\n \t\t\t\tprefix=\"$prefix$sm_path/\"\n \t\t\t\tclear_local_git_env\n \t\t\t\tcd \"$sm_path\" &&\n-\t\t\t\teval cmd_update \"$orig_flags\"\n+\t\t\t\teval cmd_update\n \t\t\t)\n \t\t\tres=$?\n \t\t\tif test $res -gt 0\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex f0b3305..2d9db8e 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -747,6 +747,17 @@ test_expect_success 'submodule update clone shallow submodule' '\n \t (cd submodule &&\n \t  test 1 = $(git log --oneline | wc -l)\n \t )\n+)\n+'\n+\n+test_expect_success 'submodule update --recursive drops module name before recursing' '\n+\t(cd super2 &&\n+\t (cd deeper/submodule/subsubmodule &&\n+\t  git checkout HEAD^\n+\t ) &&\n+\t git submodule update --recursive deeper/submodule >actual &&\n+\t test_i18ngrep \"Submodule path .deeper/submodule/subsubmodule.: checked out\" actual\n \t)\n '\n+\n test_done\n-- \n1.8.5.rc1.18.g384525a.dirty\n"}]}