{"thread":{"id":"31841","subject":"git submodule sync --recursive","startedAt":"2012-10-16T23:20:42Z","lastAt":"2012-10-26T18:50:19Z","messageCount":12,"participants":["Phil Hord","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201394","messageId":"CABURp0obPcS=KZJ4xaVouHBS_O+OuWGYxYwSU9wwnQrL5Huwzg@mail.gmail.com","threadId":"31841","inReplyTo":null,"subject":"git submodule sync --recursive","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-10-16T23:20:42Z","receivedAt":"2012-10-16T23:20:42Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"I noticed that this is not supported:\n\n    git submodule sync --recursive\n\n\nI do not see any discussion in the relevant commits about why it\ncannot or should not be supported.  Is it just an itch no one has\nscratched?\n\nPhil\n"},{"id":"201440","messageId":"507EF86C.4050807@web.de","threadId":"31841","inReplyTo":"CABURp0obPcS=KZJ4xaVouHBS_O+OuWGYxYwSU9wwnQrL5Huwzg@mail.gmail.com","subject":"Re: git submodule sync --recursive","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-10-17T18:26:52Z","receivedAt":"2012-10-17T18:26:52Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 17.10.2012 01:20, schrieb Phil Hord:\n> I noticed that this is not supported:\n> \n>     git submodule sync --recursive\n> \n> \n> I do not see any discussion in the relevant commits about why it\n> cannot or should not be supported.  Is it just an itch no one has\n> scratched?\n\nI can't remember any discussions about that either, but can't\nthink of a reason why we shouldn't support that.\n"},{"id":"201780","messageId":"1351034141-2641-1-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"507EF86C.4050807@web.de","subject":"git submodule sync --recursive","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-23T23:15:39Z","receivedAt":"2012-10-23T23:15:39Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"[PATCH 1/2] Teach --recursive to submodule sync\n[PATCH 2/2] Add tests for submodule sync --recursive\n\nThis series implements and tests git submodule sync --recursive\n"},{"id":"201778","messageId":"1351034141-2641-2-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"1351034141-2641-1-git-send-email-hordp@cisco.com","subject":"[PATCH 1/2] Teach --recursive to submodule sync","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-23T23:15:40Z","receivedAt":"2012-10-23T23:15:40Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"The submodule sync command was somehow left out when\n--recursive was added to the other submodule commands.\n\nTeach sync to handle the --recursive switch by recursing\nwhen we're in a submodule we are sync'ing.\n\nChange the report during sync to show submodule-path\ninstead of submodule-name to be consistent with the other\nsubmodule commands and to help recursed paths make sense.\n\nSigned-off-by: Phil Hord <hordp@cisco.com>\n---\n git-submodule.sh | 18 +++++++++++++++---\n 1 file changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex ab6b110..6dd2338 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -11,7 +11,7 @@ USAGE=\"[--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <r\n    or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n    or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n    or: $dashless [--quiet] foreach [--recursive] <command>\n-   or: $dashless [--quiet] sync [--] [<path>...]\"\n+   or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n OPTIONS_SPEC=\n . git-sh-setup\n . git-sh-i18n\n@@ -1008,7 +1008,9 @@ cmd_sync()\n \t\tcase \"$1\" in\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n-\t\t\tshift\n+\t\t\t;;\n+\t\t--recursive)\n+\t\t\trecursive=1\n \t\t\t;;\n \t\t--)\n \t\t\tshift\n@@ -1021,6 +1023,8 @@ cmd_sync()\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 \tcd_to_toplevel\n \tmodule_list \"$@\" |\n@@ -1051,7 +1055,7 @@ cmd_sync()\n \n \t\tif git config \"submodule.$name.url\" >/dev/null 2>/dev/null\n \t\tthen\n-\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$name'\")\"\n+\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$prefix\\$sm_path'\")\"\n \t\t\tgit config submodule.\"$name\".url \"$super_config_url\"\n \n \t\t\tif test -e \"$sm_path\"/.git\n@@ -1061,6 +1065,14 @@ cmd_sync()\n \t\t\t\tcd \"$sm_path\"\n \t\t\t\tremote=$(get_default_remote)\n \t\t\t\tgit config remote.\"$remote\".url \"$sub_origin_url\"\n+\n+\t\t\t\tif test -n \"$recursive\"\n+\t\t\t\tthen\n+\t\t\t\t(\n+\t\t\t\t\tprefix=\"$prefix$sm_path/\"\n+\t\t\t\t\teval cmd_sync \"$orig_args\"\n+\t\t\t\t)\n+\t\t\tfi\n \t\t\t)\n \t\t\tfi\n \t\tfi\n-- \n1.8.0.2.gcde19fc.dirty\n"},{"id":"201779","messageId":"1351034141-2641-3-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"1351034141-2641-1-git-send-email-hordp@cisco.com","subject":"[PATCH 2/2] Add tests for submodule sync --recursive","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-23T23:15:41Z","receivedAt":"2012-10-23T23:15:41Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"Signed-off-by: Phil Hord <hordp@cisco.com>\n---\n t/t7403-submodule-sync.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 53 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh\nindex 524d5c1..94e26c4 100755\n--- a/t/t7403-submodule-sync.sh\n+++ b/t/t7403-submodule-sync.sh\n@@ -17,18 +17,25 @@ test_expect_success setup '\n \tgit commit -m upstream &&\n \tgit clone . super &&\n \tgit clone super submodule &&\n+\t(cd submodule &&\n+\t git submodule add ../submodule sub-submodule &&\n+\t test_tick &&\n+\t git commit -m \"sub-submodule\"\n+\t) &&\n \t(cd super &&\n \t git submodule add ../submodule submodule &&\n \t test_tick &&\n \t git commit -m \"submodule\"\n \t) &&\n \tgit clone super super-clone &&\n-\t(cd super-clone && git submodule update --init) &&\n+\t(cd super-clone && git submodule update --init --recursive) &&\n \tgit clone super empty-clone &&\n \t(cd empty-clone && git submodule init) &&\n \tgit clone super top-only-clone &&\n \tgit clone super relative-clone &&\n-\t(cd relative-clone && git submodule update --init)\n+\t(cd relative-clone && git submodule update --init --recursive) &&\n+\tgit clone super recursive-clone &&\n+\t(cd recursive-clone && git submodule update --init --recursive)\n '\n \n test_expect_success 'change submodule' '\n@@ -46,6 +53,11 @@ test_expect_success 'change submodule url' '\n \t git pull\n \t) &&\n \tmv submodule moved-submodule &&\n+\t(cd moved-submodule &&\n+\t git config -f .gitmodules submodule.sub-submodule.url ../moved-submodule &&\n+\t test_tick &&\n+\t git commit -a -m moved-sub-submodule\n+\t) &&\n \t(cd super &&\n \t git config -f .gitmodules submodule.submodule.url ../moved-submodule &&\n \t test_tick &&\n@@ -61,6 +73,9 @@ test_expect_success '\"git submodule sync\" should update submodule URLs' '\n \ttest -d \"$(cd super-clone/submodule &&\n \t git config remote.origin.url\n \t)\" &&\n+\ttest ! -d \"$(cd super-clone/submodule/sub-submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n \t(cd super-clone/submodule &&\n \t git checkout master &&\n \t git pull\n@@ -70,6 +85,25 @@ test_expect_success '\"git submodule sync\" should update submodule URLs' '\n \t)\n '\n \n+test_expect_success '\"git submodule sync --recursive\" should update all submodule URLs' '\n+\t(cd super-clone &&\n+\t (cd submodule &&\n+\t  git pull --no-recurse-submodules\n+\t ) &&\n+\t git submodule sync --recursive\n+\t) &&\n+\ttest -d \"$(cd super-clone/submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n+\ttest -d \"$(cd super-clone/submodule/sub-submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n+\t(cd super-clone/submodule/sub-submodule &&\n+\t git checkout master &&\n+\t git pull\n+\t)\n+'\n+\n test_expect_success '\"git submodule sync\" should update known submodule URLs' '\n \t(cd empty-clone &&\n \t git pull &&\n@@ -107,6 +141,23 @@ test_expect_success '\"git submodule sync\" handles origin URL of the form foo/bar\n \t #actual foo/submodule\n \t test \"$(git config remote.origin.url)\" = \"../foo/submodule\"\n \t)\n+\t(cd submodule/sub-submodule &&\n+\t test \"$(git config remote.origin.url)\" != \"../../foo/submodule\"\n+\t)\n+\t)\n+'\n+\n+test_expect_success '\"git submodule sync --recursive\" propagates changes in origin' '\n+\t(cd recursive-clone &&\n+\t git remote set-url origin foo/bar &&\n+\t git submodule sync --recursive &&\n+\t(cd submodule &&\n+\t #actual foo/submodule\n+\t test \"$(git config remote.origin.url)\" = \"../foo/submodule\"\n+\t)\n+\t(cd submodule/sub-submodule &&\n+\t test \"$(git config remote.origin.url)\" = \"../../foo/submodule\"\n+\t)\n \t)\n '\n \n-- \n1.8.0.2.gcde19fc.dirty\n"},{"id":"201923","messageId":"5089BBE1.3040107@web.de","threadId":"31841","inReplyTo":"1351034141-2641-2-git-send-email-hordp@cisco.com","subject":"Re: [PATCH 1/2] Teach --recursive to submodule sync","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-10-25T22:23:29Z","receivedAt":"2012-10-25T22:23:29Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 24.10.2012 01:15, schrieb Phil Hord:\n> The submodule sync command was somehow left out when\n> --recursive was added to the other submodule commands.\n> \n> Teach sync to handle the --recursive switch by recursing\n> when we're in a submodule we are sync'ing.\n> \n> Change the report during sync to show submodule-path\n> instead of submodule-name to be consistent with the other\n> submodule commands and to help recursed paths make sense.\n> \n> Signed-off-by: Phil Hord <hordp@cisco.com>\n\nThis makes perfect sense to me. Two things though:\n\nFirst it would be nice to initialize orig_flags like all the other\ncall sites do:\n\n@@ -1003,6 +1003,7 @@ cmd_status()\n #\n cmd_sync()\n {\n+\torig_flags=\n \twhile test $# -ne 0\n \tdo\n \t\tcase \"$1\" in\n\n> ---\n>  git-submodule.sh | 18 +++++++++++++++---\n>  1 file changed, 15 insertions(+), 3 deletions(-)\n> \n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index ab6b110..6dd2338 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -11,7 +11,7 @@ USAGE=\"[--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <r\n>     or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n>     or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n>     or: $dashless [--quiet] foreach [--recursive] <command>\n> -   or: $dashless [--quiet] sync [--] [<path>...]\"\n> +   or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n>  OPTIONS_SPEC=\n>  . git-sh-setup\n>  . git-sh-i18n\n> @@ -1008,7 +1008,9 @@ cmd_sync()\n>  \t\tcase \"$1\" in\n>  \t\t-q|--quiet)\n>  \t\t\tGIT_QUIET=1\n> -\t\t\tshift\n> +\t\t\t;;\n> +\t\t--recursive)\n> +\t\t\trecursive=1\n>  \t\t\t;;\n>  \t\t--)\n>  \t\t\tshift\n> @@ -1021,6 +1023,8 @@ cmd_sync()\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>  \tcd_to_toplevel\n>  \tmodule_list \"$@\" |\n> @@ -1051,7 +1055,7 @@ cmd_sync()\n>  \n>  \t\tif git config \"submodule.$name.url\" >/dev/null 2>/dev/null\n>  \t\tthen\n> -\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$name'\")\"\n> +\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$prefix\\$sm_path'\")\"\n>  \t\t\tgit config submodule.\"$name\".url \"$super_config_url\"\n>  \n>  \t\t\tif test -e \"$sm_path\"/.git\n> @@ -1061,6 +1065,14 @@ cmd_sync()\n>  \t\t\t\tcd \"$sm_path\"\n>  \t\t\t\tremote=$(get_default_remote)\n>  \t\t\t\tgit config remote.\"$remote\".url \"$sub_origin_url\"\n> +\n> +\t\t\t\tif test -n \"$recursive\"\n> +\t\t\t\tthen\n> +\t\t\t\t(\n> +\t\t\t\t\tprefix=\"$prefix$sm_path/\"\n> +\t\t\t\t\teval cmd_sync \"$orig_args\"\n\nThis should read 'eval cmd_sync \"$orig_flags\"'. I think you copied that\nfrom cmd_status(), where this is also incorrect, I just sent a patch to\ncorrect that one.\n\n> +\t\t\t\t)\n> +\t\t\tfi\n>  \t\t\t)\n>  \t\t\tfi\n>  \t\tfi\n> \n"},{"id":"201968","messageId":"508AC63E.6010502@cisco.com","threadId":"31841","inReplyTo":"5089BBE1.3040107@web.de","subject":"Re: [PATCH 1/2] Teach --recursive to submodule sync","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-26T17:19:58Z","receivedAt":"2012-10-26T17:19:58Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"\nJens Lehmann wrote:\n> Am 24.10.2012 01:15, schrieb Phil Hord:\n>> The submodule sync command was somehow left out when\n>> --recursive was added to the other submodule commands.\n>>\n>> Teach sync to handle the --recursive switch by recursing\n>> when we're in a submodule we are sync'ing.\n>>\n>> Change the report during sync to show submodule-path\n>> instead of submodule-name to be consistent with the other\n>> submodule commands and to help recursed paths make sense.\n>>\n>> Signed-off-by: Phil Hord <hordp@cisco.com>\n> This makes perfect sense to me. Two things though:\n>\n> First it would be nice to initialize orig_flags like all the other\n> call sites do:\n>\n> @@ -1003,6 +1003,7 @@ cmd_status()\n>  #\n>  cmd_sync()\n>  {\n> +\torig_flags=\n>  \twhile test $# -ne 0\n>  \tdo\n>  \t\tcase \"$1\" in\n>\n>> ---\n>>  git-submodule.sh | 18 +++++++++++++++---\n>>  1 file changed, 15 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/git-submodule.sh b/git-submodule.sh\n>> index ab6b110..6dd2338 100755\n>> --- a/git-submodule.sh\n>> +++ b/git-submodule.sh\n>> @@ -11,7 +11,7 @@ USAGE=\"[--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <r\n>>     or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n>>     or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n>>     or: $dashless [--quiet] foreach [--recursive] <command>\n>> -   or: $dashless [--quiet] sync [--] [<path>...]\"\n>> +   or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n>>  OPTIONS_SPEC=\n>>  . git-sh-setup\n>>  . git-sh-i18n\n>> @@ -1008,7 +1008,9 @@ cmd_sync()\n>>  \t\tcase \"$1\" in\n>>  \t\t-q|--quiet)\n>>  \t\t\tGIT_QUIET=1\n>> -\t\t\tshift\n>> +\t\t\t;;\n>> +\t\t--recursive)\n>> +\t\t\trecursive=1\n>>  \t\t\t;;\n>>  \t\t--)\n>>  \t\t\tshift\n>> @@ -1021,6 +1023,8 @@ cmd_sync()\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>>  \tcd_to_toplevel\n>>  \tmodule_list \"$@\" |\n>> @@ -1051,7 +1055,7 @@ cmd_sync()\n>>  \n>>  \t\tif git config \"submodule.$name.url\" >/dev/null 2>/dev/null\n>>  \t\tthen\n>> -\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$name'\")\"\n>> +\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$prefix\\$sm_path'\")\"\n>>  \t\t\tgit config submodule.\"$name\".url \"$super_config_url\"\n>>  \n>>  \t\t\tif test -e \"$sm_path\"/.git\n>> @@ -1061,6 +1065,14 @@ cmd_sync()\n>>  \t\t\t\tcd \"$sm_path\"\n>>  \t\t\t\tremote=$(get_default_remote)\n>>  \t\t\t\tgit config remote.\"$remote\".url \"$sub_origin_url\"\n>> +\n>> +\t\t\t\tif test -n \"$recursive\"\n>> +\t\t\t\tthen\n>> +\t\t\t\t(\n>> +\t\t\t\t\tprefix=\"$prefix$sm_path/\"\n>> +\t\t\t\t\teval cmd_sync \"$orig_args\"\n> This should read 'eval cmd_sync \"$orig_flags\"'. I think you copied that\n> from cmd_status(), where this is also incorrect, I just sent a patch to\n> correct that one.\n\nYes, thanks for catching that.  I think I should add a test for that\nexcept I notice that sync doesn't take any other flags useful for passing.\n\nv2 is on the way.\n\n>> +\t\t\t\t)\n>> +\t\t\tfi\n>>  \t\t\t)\n>>  \t\t\tfi\n>>  \t\tfi\n>>\n"},{"id":"201969","messageId":"1351272691-24718-1-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"5089BBE1.3040107@web.de","subject":"[PATCHv2 0/2] Reroll submodule sync --recursive","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-26T17:31:29Z","receivedAt":"2012-10-26T17:31:29Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"\nThis one fixes \"$orig_flags\" problems noticed by Jens.\nCopy-and-paste is gift from Satan.\n\nPhil\n"},{"id":"201970","messageId":"1351272691-24718-2-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"1351272691-24718-1-git-send-email-hordp@cisco.com","subject":"[PATCHv2 1/2] Teach --recursive to submodule sync","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-26T17:31:30Z","receivedAt":"2012-10-26T17:31:30Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"The submodule sync command was somehow left out when\n--recursive was added to the other submodule commands.\n\nTeach sync to handle the --recursive switch by recursing\nwhen we're in a submodule we are sync'ing.\n\nChange the report during sync to show submodule-path\ninstead of submodule-name to be consistent with the other\nsubmodule commands and to help recursed paths make sense.\n\nSigned-off-by: Phil Hord <hordp@cisco.com>\n---\n git-submodule.sh | 19 ++++++++++++++++---\n 1 file changed, 16 insertions(+), 3 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex ab6b110..f40da72 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -11,7 +11,7 @@ USAGE=\"[--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <r\n    or: $dashless [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n    or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n    or: $dashless [--quiet] foreach [--recursive] <command>\n-   or: $dashless [--quiet] sync [--] [<path>...]\"\n+   or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n OPTIONS_SPEC=\n . git-sh-setup\n . git-sh-i18n\n@@ -1003,12 +1003,15 @@ cmd_status()\n #\n cmd_sync()\n {\n+\torig_flags=\n \twhile test $# -ne 0\n \tdo\n \t\tcase \"$1\" in\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n-\t\t\tshift\n+\t\t\t;;\n+\t\t--recursive)\n+\t\t\trecursive=1\n \t\t\t;;\n \t\t--)\n \t\t\tshift\n@@ -1021,6 +1024,8 @@ cmd_sync()\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 \tcd_to_toplevel\n \tmodule_list \"$@\" |\n@@ -1051,7 +1056,7 @@ cmd_sync()\n \n \t\tif git config \"submodule.$name.url\" >/dev/null 2>/dev/null\n \t\tthen\n-\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$name'\")\"\n+\t\t\tsay \"$(eval_gettext \"Synchronizing submodule url for '\\$prefix\\$sm_path'\")\"\n \t\t\tgit config submodule.\"$name\".url \"$super_config_url\"\n \n \t\t\tif test -e \"$sm_path\"/.git\n@@ -1061,6 +1066,14 @@ cmd_sync()\n \t\t\t\tcd \"$sm_path\"\n \t\t\t\tremote=$(get_default_remote)\n \t\t\t\tgit config remote.\"$remote\".url \"$sub_origin_url\"\n+\n+\t\t\t\tif test -n \"$recursive\"\n+\t\t\t\tthen\n+\t\t\t\t(\n+\t\t\t\t\tprefix=\"$prefix$sm_path/\"\n+\t\t\t\t\teval cmd_sync \"$orig_flags\"\n+\t\t\t\t)\n+\t\t\tfi\n \t\t\t)\n \t\t\tfi\n \t\tfi\n-- \n1.8.0.2.g35128e8\n"},{"id":"201971","messageId":"1351272691-24718-3-git-send-email-hordp@cisco.com","threadId":"31841","inReplyTo":"1351272691-24718-1-git-send-email-hordp@cisco.com","subject":"[PATCHv2 2/2] Add tests for submodule sync --recursive","fromName":"Phil Hord","fromEmail":"hordp@cisco.com","sentAt":"2012-10-26T17:31:31Z","receivedAt":"2012-10-26T17:31:31Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"Signed-off-by: Phil Hord <hordp@cisco.com>\n---\n t/t7403-submodule-sync.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 53 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh\nindex 524d5c1..94e26c4 100755\n--- a/t/t7403-submodule-sync.sh\n+++ b/t/t7403-submodule-sync.sh\n@@ -17,18 +17,25 @@ test_expect_success setup '\n \tgit commit -m upstream &&\n \tgit clone . super &&\n \tgit clone super submodule &&\n+\t(cd submodule &&\n+\t git submodule add ../submodule sub-submodule &&\n+\t test_tick &&\n+\t git commit -m \"sub-submodule\"\n+\t) &&\n \t(cd super &&\n \t git submodule add ../submodule submodule &&\n \t test_tick &&\n \t git commit -m \"submodule\"\n \t) &&\n \tgit clone super super-clone &&\n-\t(cd super-clone && git submodule update --init) &&\n+\t(cd super-clone && git submodule update --init --recursive) &&\n \tgit clone super empty-clone &&\n \t(cd empty-clone && git submodule init) &&\n \tgit clone super top-only-clone &&\n \tgit clone super relative-clone &&\n-\t(cd relative-clone && git submodule update --init)\n+\t(cd relative-clone && git submodule update --init --recursive) &&\n+\tgit clone super recursive-clone &&\n+\t(cd recursive-clone && git submodule update --init --recursive)\n '\n \n test_expect_success 'change submodule' '\n@@ -46,6 +53,11 @@ test_expect_success 'change submodule url' '\n \t git pull\n \t) &&\n \tmv submodule moved-submodule &&\n+\t(cd moved-submodule &&\n+\t git config -f .gitmodules submodule.sub-submodule.url ../moved-submodule &&\n+\t test_tick &&\n+\t git commit -a -m moved-sub-submodule\n+\t) &&\n \t(cd super &&\n \t git config -f .gitmodules submodule.submodule.url ../moved-submodule &&\n \t test_tick &&\n@@ -61,6 +73,9 @@ test_expect_success '\"git submodule sync\" should update submodule URLs' '\n \ttest -d \"$(cd super-clone/submodule &&\n \t git config remote.origin.url\n \t)\" &&\n+\ttest ! -d \"$(cd super-clone/submodule/sub-submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n \t(cd super-clone/submodule &&\n \t git checkout master &&\n \t git pull\n@@ -70,6 +85,25 @@ test_expect_success '\"git submodule sync\" should update submodule URLs' '\n \t)\n '\n \n+test_expect_success '\"git submodule sync --recursive\" should update all submodule URLs' '\n+\t(cd super-clone &&\n+\t (cd submodule &&\n+\t  git pull --no-recurse-submodules\n+\t ) &&\n+\t git submodule sync --recursive\n+\t) &&\n+\ttest -d \"$(cd super-clone/submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n+\ttest -d \"$(cd super-clone/submodule/sub-submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n+\t(cd super-clone/submodule/sub-submodule &&\n+\t git checkout master &&\n+\t git pull\n+\t)\n+'\n+\n test_expect_success '\"git submodule sync\" should update known submodule URLs' '\n \t(cd empty-clone &&\n \t git pull &&\n@@ -107,6 +141,23 @@ test_expect_success '\"git submodule sync\" handles origin URL of the form foo/bar\n \t #actual foo/submodule\n \t test \"$(git config remote.origin.url)\" = \"../foo/submodule\"\n \t)\n+\t(cd submodule/sub-submodule &&\n+\t test \"$(git config remote.origin.url)\" != \"../../foo/submodule\"\n+\t)\n+\t)\n+'\n+\n+test_expect_success '\"git submodule sync --recursive\" propagates changes in origin' '\n+\t(cd recursive-clone &&\n+\t git remote set-url origin foo/bar &&\n+\t git submodule sync --recursive &&\n+\t(cd submodule &&\n+\t #actual foo/submodule\n+\t test \"$(git config remote.origin.url)\" = \"../foo/submodule\"\n+\t)\n+\t(cd submodule/sub-submodule &&\n+\t test \"$(git config remote.origin.url)\" = \"../../foo/submodule\"\n+\t)\n \t)\n '\n \n-- \n1.8.0.2.g35128e8\n"},{"id":"201972","messageId":"CABURp0q0uELTS4DQ=Kqfr+8Pr-KgLcGJaBY_kJE_AiO=BZu+Bw@mail.gmail.com","threadId":"31841","inReplyTo":"508AC63E.6010502@cisco.com","subject":"Re: [PATCH 1/2] Teach --recursive to submodule sync","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-10-26T17:55:58Z","receivedAt":"2012-10-26T17:55:58Z","isPatch":true,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Fri, Oct 26, 2012 at 1:19 PM, Phil Hord <hordp@cisco.com> wrote:\n>\n> Yes, thanks for catching that.  I think I should add a test for that\n> except I notice that sync doesn't take any other flags useful for passing.\n\nWhich, of course, suggests that I should not add this\nflag-propagating-machinery to submodule-sync at all. yes?\n\nPhil\n"},{"id":"201977","messageId":"508ADB6B.5040905@web.de","threadId":"31841","inReplyTo":"CABURp0q0uELTS4DQ=Kqfr+8Pr-KgLcGJaBY_kJE_AiO=BZu+Bw@mail.gmail.com","subject":"Re: [PATCH 1/2] Teach --recursive to submodule sync","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-10-26T18:50:19Z","receivedAt":"2012-10-26T18:50:19Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 26.10.2012 19:55, schrieb Phil Hord:\n> On Fri, Oct 26, 2012 at 1:19 PM, Phil Hord <hordp@cisco.com> wrote:\n>>\n>> Yes, thanks for catching that.  I think I should add a test for that\n>> except I notice that sync doesn't take any other flags useful for passing.\n> \n> Which, of course, suggests that I should not add this\n> flag-propagating-machinery to submodule-sync at all. yes?\n\nNope, the new --recursive option has to be passed on!\n\nTo catch that bug in your test you'd need another submodule inside your\nsub-submodule. The first level submodule is initialized by sync anyways,\nthe sub-submodule is initialized by the --recursive logic you added but\nthe sub-sub-submodule would not have been synced because the option was\ndropped. I really can't blame you for not adding that third level of\nsubmodules ;-)\n"}]}