{"thread":{"id":"48381","subject":"git-submodule is missing --dissociate option","startedAt":"2018-04-30T08:29:27Z","lastAt":"2018-05-03T10:46:45Z","messageCount":29,"participants":["Casey Fitzpatrick","Ævar Arnfjörð Bjarmason","Stefan Beller","Eric Sunshine","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"346127","messageId":"CAEp-SHXo2fnyUSMDqJnfOkh_R21R2FjFUtQ14u9s6-tV039tHg@mail.gmail.com","threadId":"48381","inReplyTo":null,"subject":"git-submodule is missing --dissociate option","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-04-30T08:29:23Z","receivedAt":"2018-04-30T08:29:27Z","isPatch":false,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"This seems to be a hole in the git feature set. I believe it is fairly\neasily worked around, but it would be best to provide the option for\nease of use (and maybe performance?).\n\ngit clone has both a --reference feature and a --dissociate option,\nwith dissociate allowing for a reference to *only* speed up network\ntransfers rather than have the resulting clone rely upon the reference\nalways being there (creates an independent repo).\nBut git submodule only allows for --reference, so there isn't a an\noption to make a speedy independent submodule clone in one shot:\nhttps://git-scm.com/docs/git-submodule\nI checked the latest online documentation (currently at 2.16.3) and\nthe documentation in the latest sources (almost 2.18):\nhttps://github.com/git/git/blob/next/Documentation/git-submodule.txt\n\nAs far as I am aware this can be worked around with 'git repack -a'\nand manual removal of the objects/info/alternates file afterward.\nThough I don't know if this results in a less speedy clone than\ndissociate would.\n"},{"id":"346137","messageId":"CAEp-SHXXwtgDb=bzTmT88aPQ267ANLCN6S3teC4hjHYDL9NQ3Q@mail.gmail.com","threadId":"48381","inReplyTo":"CAEp-SHXo2fnyUSMDqJnfOkh_R21R2FjFUtQ14u9s6-tV039tHg@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-04-30T11:30:30Z","receivedAt":"2018-04-30T11:30:34Z","isPatch":false,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"It also seems to be missing \"--progress\", and I imagine others.\nPerhaps submodule add/update should be reworked to automatically\naccept all the options that clone would?\n\nOn Mon, Apr 30, 2018 at 4:29 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> This seems to be a hole in the git feature set. I believe it is fairly\n> easily worked around, but it would be best to provide the option for\n> ease of use (and maybe performance?).\n>\n> git clone has both a --reference feature and a --dissociate option,\n> with dissociate allowing for a reference to *only* speed up network\n> transfers rather than have the resulting clone rely upon the reference\n> always being there (creates an independent repo).\n> But git submodule only allows for --reference, so there isn't a an\n> option to make a speedy independent submodule clone in one shot:\n> https://git-scm.com/docs/git-submodule\n> I checked the latest online documentation (currently at 2.16.3) and\n> the documentation in the latest sources (almost 2.18):\n> https://github.com/git/git/blob/next/Documentation/git-submodule.txt\n>\n> As far as I am aware this can be worked around with 'git repack -a'\n> and manual removal of the objects/info/alternates file afterward.\n> Though I don't know if this results in a less speedy clone than\n> dissociate would.\n"},{"id":"346146","messageId":"CACBZZX4NMJE0kcgb0aB0z3X6yGhL8VJVx6V3tYfA3socbjTQfA@mail.gmail.com","threadId":"48381","inReplyTo":"CAEp-SHXXwtgDb=bzTmT88aPQ267ANLCN6S3teC4hjHYDL9NQ3Q@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-04-30T13:16:19Z","receivedAt":"2018-04-30T13:16:43Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Apr 30, 2018 at 1:30 PM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> It also seems to be missing \"--progress\", and I imagine others.\n> Perhaps submodule add/update should be reworked to automatically\n> accept all the options that clone would?\n\n--progress is not missing, but I see that it isn't documented. It was\nadded in 72c5f88311 (\"clone: pass --progress decision to recursive\nsubmodules\", 2016-09-22). What you're suggesting makes sense, but as\nshown in that commit it's not easy for it to happen automatically,\nthere's a lot of boilerplate involved.\n\nBut since you're interested you can see how to add new options with\nthat patch, it should be easy for anyone not experienced with the\ncodebase, it's all just boilerplate + adding a test.\n\n> On Mon, Apr 30, 2018 at 4:29 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>> This seems to be a hole in the git feature set. I believe it is fairly\n>> easily worked around, but it would be best to provide the option for\n>> ease of use (and maybe performance?).\n>>\n>> git clone has both a --reference feature and a --dissociate option,\n>> with dissociate allowing for a reference to *only* speed up network\n>> transfers rather than have the resulting clone rely upon the reference\n>> always being there (creates an independent repo).\n>> But git submodule only allows for --reference, so there isn't a an\n>> option to make a speedy independent submodule clone in one shot:\n>> https://git-scm.com/docs/git-submodule\n>> I checked the latest online documentation (currently at 2.16.3) and\n>> the documentation in the latest sources (almost 2.18):\n>> https://github.com/git/git/blob/next/Documentation/git-submodule.txt\n>>\n>> As far as I am aware this can be worked around with 'git repack -a'\n>> and manual removal of the objects/info/alternates file afterward.\n>> Though I don't know if this results in a less speedy clone than\n>> dissociate would.\n"},{"id":"346184","messageId":"CAGZ79kZQ3ce8QTJy2Siiuoz=pa6qWweNc8GTpoygkvKuoFXaAA@mail.gmail.com","threadId":"48381","inReplyTo":"CAEp-SHXo2fnyUSMDqJnfOkh_R21R2FjFUtQ14u9s6-tV039tHg@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-04-30T18:19:08Z","receivedAt":"2018-04-30T18:19:12Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Apr 30, 2018 at 1:29 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> This seems to be a hole in the git feature set. I believe it is fairly\n> easily worked around, but it would be best to provide the option for\n> ease of use (and maybe performance?).\n>\n> git clone has both a --reference feature and a --dissociate option,\n> with dissociate allowing for a reference to *only* speed up network\n> transfers rather than have the resulting clone rely upon the reference\n> always being there (creates an independent repo).\n\nWith the advent of git-worktree, I claim that --reference without further\n--dissociate is dangerous, such that the combination of these two are\nnot the best UX, you could wish for.\n\n> But git submodule only allows for --reference, so there isn't a an\n> option to make a speedy independent submodule clone in one shot:\n> https://git-scm.com/docs/git-submodule\n> I checked the latest online documentation (currently at 2.16.3) and\n> the documentation in the latest sources (almost 2.18):\n> https://github.com/git/git/blob/next/Documentation/git-submodule.txt\n>\n> As far as I am aware this can be worked around with 'git repack -a'\n> and manual removal of the objects/info/alternates file afterward.\n> Though I don't know if this results in a less speedy clone than\n> dissociate would.\n\nThat is an interesting workaround!\nI agree we should have the --dissociate option available for submodules.\nCare to implement it?\n\nThanks,\nStefan\n"},{"id":"346194","messageId":"CAEp-SHV4hP=v_=AJExRS3hqT-x9rXEONofWD=sVQZC79uewATA@mail.gmail.com","threadId":"48381","inReplyTo":"CAGZ79kZQ3ce8QTJy2Siiuoz=pa6qWweNc8GTpoygkvKuoFXaAA@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-04-30T21:39:31Z","receivedAt":"2018-04-30T21:39:35Z","isPatch":false,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Sure, I'll take a crack at it and submit a patch.\n\nOn Mon, Apr 30, 2018 at 2:19 PM, Stefan Beller <sbeller@google.com> wrote:\n> On Mon, Apr 30, 2018 at 1:29 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>> This seems to be a hole in the git feature set. I believe it is fairly\n>> easily worked around, but it would be best to provide the option for\n>> ease of use (and maybe performance?).\n>>\n>> git clone has both a --reference feature and a --dissociate option,\n>> with dissociate allowing for a reference to *only* speed up network\n>> transfers rather than have the resulting clone rely upon the reference\n>> always being there (creates an independent repo).\n>\n> With the advent of git-worktree, I claim that --reference without further\n> --dissociate is dangerous, such that the combination of these two are\n> not the best UX, you could wish for.\n>\n>> But git submodule only allows for --reference, so there isn't a an\n>> option to make a speedy independent submodule clone in one shot:\n>> https://git-scm.com/docs/git-submodule\n>> I checked the latest online documentation (currently at 2.16.3) and\n>> the documentation in the latest sources (almost 2.18):\n>> https://github.com/git/git/blob/next/Documentation/git-submodule.txt\n>>\n>> As far as I am aware this can be worked around with 'git repack -a'\n>> and manual removal of the objects/info/alternates file afterward.\n>> Though I don't know if this results in a less speedy clone than\n>> dissociate would.\n>\n> That is an interesting workaround!\n> I agree we should have the --dissociate option available for submodules.\n> Care to implement it?\n>\n> Thanks,\n> Stefan\n"},{"id":"346303","messageId":"20180501180908.17443-1-kcghost@gmail.com","threadId":"48381","inReplyTo":"CAEp-SHV4hP=v_=AJExRS3hqT-x9rXEONofWD=sVQZC79uewATA@mail.gmail.com","subject":"[PATCH 0/2] Add --progress and --dissociate to git submodule","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-01T18:09:06Z","receivedAt":"2018-05-01T18:15:40Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"These patches add --progress and --dissociate options to git submodule.\n\nThe --progress option existed beforehand, but only for the update command and\nit was left undocumented.\n\nBoth add and update submodule commands supported --reference, but not its pair\noption --dissociate which allows for independent clones rather than depending\non the reference.\n\nI apologize for any errors I may have made in creation of these patches or the\nformatting of these emails. This is the first time I have submitted patches to\na mailing list.\n\nCasey Fitzpatrick (2):\n  submodule: Add --progress option to add command\n  submodule: Add --dissociate option to add/update commands\n\n Documentation/git-submodule.txt | 17 ++++++++++++++++-\n builtin/submodule--helper.c     | 17 ++++++++++++++---\n git-submodule.sh                | 13 ++++++++++++-\n t/t7400-submodule-basic.sh      | 31 +++++++++++++++++++++++++++++++\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 5 files changed, 90 insertions(+), 5 deletions(-)\n\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346304","messageId":"20180501180908.17443-2-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-1-kcghost@gmail.com","subject":"[PATCH 1/2] submodule: Add --progress option to add command","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-01T18:09:07Z","receivedAt":"2018-05-01T18:15:47Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"--progress was missing from add command, was only in update.\nAdd --progress where it makes sense (both clone helper commands).\nAdd missing documentation entry.\nAdd test.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt |  7 +++++++\n git-submodule.sh                |  5 ++++-\n t/t7400-submodule-basic.sh      | 31 +++++++++++++++++++++++++++++++\n 3 files changed, 42 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex 71c5618e8..d1ebe32e8 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -239,6 +239,13 @@ OPTIONS\n --quiet::\n \tOnly print error messages.\n \n+--progress::\n+\tThis option is only valid for add and update commands.\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless -q\n+\tis specified. This flag forces progress status even if the\n+\tstandard error stream is not directed to a terminal.\n+\n --all::\n \tThis option is only valid for the deinit command. Unregister all\n \tsubmodules in the working tree.\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 24914963c..aa1c0bb67 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -117,6 +117,9 @@ cmd_add()\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n+\t\t--progress)\n+\t\t\tprogress=\"--progress\"\n+\t\t\t;;\n \t\t--reference)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\treference_path=$2\n@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex a39e69a3e..d7225a74b 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -126,6 +126,37 @@ test_expect_success 'submodule add' '\n \ttest_cmp empty untracked\n '\n \n+test_expect_success 'setup test repo' '\n+\tmkdir parent &&\n+\t(cd parent && git init &&\n+\t echo one >file && git add file &&\n+\t git commit -m one)\n+'\n+\n+test_expect_success 'clone -o' '\n+\tgit clone -o foo parent clone-o &&\n+\t(cd clone-o && git rev-parse --verify refs/remotes/foo/master)\n+'\n+\n+test_expect_success 'redirected submodule add does not show progress' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"file://$submodurl/parent\" submod-redirected \\\n+\t\t\t>out 2>err &&\n+\t\t! grep % err &&\n+\t\ttest_i18ngrep ! \"Checking connectivity\" err\n+\t)\n+'\n+\n+test_expect_success 'redirected submodule add --progress does show progress' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add --progress \"file://$submodurl/parent\" \\\n+\t\t\tsubmod-redirected-progress >out 2>err && \\\n+\t\tgrep % err\n+\t)\n+'\n+\n test_expect_success 'submodule add to .gitignored path fails' '\n \t(\n \t\tcd addtest-ignore &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346305","messageId":"20180501180908.17443-3-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-1-kcghost@gmail.com","subject":"[PATCH 2/2] submodule: Add --dissociate option to add/update commands","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-01T18:09:08Z","receivedAt":"2018-05-01T18:15:53Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Add --dissociate option to add and update commands, both clone helper commands\nthat already have the --reference option --dissociate pairs with.\nAdd documentation.\nAdd tests.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt | 10 +++++++++-\n builtin/submodule--helper.c     | 17 ++++++++++++++---\n git-submodule.sh                | 10 +++++++++-\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 4 files changed, 49 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex d1ebe32e8..a75b95043 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -369,7 +369,15 @@ the submodule itself.\n \tthis option will be passed to the linkgit:git-clone[1] command.\n +\n *NOTE*: Do *not* use this option unless you have read the note\n-for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.\n+for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`\n+options carefully.\n+\n+--dissociate::\n+\tThis option is only valid for add and update commands.  These\n+\tcommands sometimes need to clone a remote repository. In this case,\n+\tthis option will be passed to the linkgit:git-clone[1] command.\n++\n+*NOTE*: see the NOTE for the `--reference` option.\n \n --recursive::\n \tThis option is only valid for foreach, update, status and sync commands.\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 6ba8587b6..655f84f3c 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1056,7 +1056,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)\n }\n \n static int clone_submodule(const char *path, const char *gitdir, const char *url,\n-\t\t\t   const char *depth, struct string_list *reference,\n+\t\t\t   const char *depth, struct string_list *reference, int dissociate,\n \t\t\t   int quiet, int progress)\n {\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -1075,6 +1075,9 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n \t\t\targv_array_pushl(&cp.args, \"--reference\",\n \t\t\t\t\t item->string, NULL);\n \t}\n+\tif (dissociate) {\n+\t\targv_array_push(&cp.args, \"--dissociate\");\n+\t}\n \tif (gitdir && *gitdir)\n \t\targv_array_pushl(&cp.args, \"--separate-git-dir\", gitdir, NULL);\n \n@@ -1190,6 +1193,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \tchar *p, *path = NULL, *sm_gitdir;\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct string_list reference = STRING_LIST_INIT_NODUP;\n+\tint dissociate = 0;\n \tchar *sm_alternate = NULL, *error_strategy = NULL;\n \n \tstruct option module_clone_options[] = {\n@@ -1208,6 +1212,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING_LIST(0, \"reference\", &reference,\n \t\t\t   N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &depth,\n \t\t\t   N_(\"string\"),\n \t\t\t   N_(\"depth for shallow clones\")),\n@@ -1247,7 +1253,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \n \t\tprepare_possible_alternates(name, &reference);\n \n-\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference,\n+\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference, dissociate,\n \t\t\t\t    quiet, progress))\n \t\t\tdie(_(\"clone of '%s' into submodule path '%s' failed\"),\n \t\t\t    url, path);\n@@ -1300,6 +1306,7 @@ struct submodule_update_clone {\n \tint quiet;\n \tint recommend_shallow;\n \tstruct string_list references;\n+\tint dissociate;\n \tconst char *depth;\n \tconst char *recursive_prefix;\n \tconst char *prefix;\n@@ -1315,7 +1322,7 @@ struct submodule_update_clone {\n \tint failed_clones_nr, failed_clones_alloc;\n };\n #define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \\\n-\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \\\n+\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \\\n \tNULL, NULL, NULL, \\\n \tSTRING_LIST_INIT_DUP, 0, NULL, 0, 0}\n \n@@ -1442,6 +1449,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n \t\tfor_each_string_list_item(item, &suc->references)\n \t\t\targv_array_pushl(&child->args, \"--reference\", item->string, NULL);\n \t}\n+\tif (suc->dissociate)\n+\t\targv_array_push(&child->args, \"--dissociate\");\n \tif (suc->depth)\n \t\targv_array_push(&child->args, suc->depth);\n \n@@ -1575,6 +1584,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n \t\t\t   N_(\"rebase, merge, checkout or none\")),\n \t\tOPT_STRING_LIST(0, \"reference\", &suc.references, N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &suc.dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &suc.depth, \"<depth>\",\n \t\t\t   N_(\"Create a shallow clone truncated to the \"\n \t\t\t      \"specified number of revisions\")),\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex aa1c0bb67..4743b4745 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -42,6 +42,7 @@ prefix=\n custom_name=\n depth=\n progress=\n+dissociate=\n \n die_if_unmatched ()\n {\n@@ -128,6 +129,9 @@ cmd_add()\n \t\t--reference=*)\n \t\t\treference_path=\"${1#--reference=}\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=\"--dissociate\"\n+\t\t\t;;\n \t\t--name)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\tcustom_name=$2\n@@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"$dissociate\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\n@@ -493,6 +497,9 @@ cmd_update()\n \t\t--reference=*)\n \t\t\treference=\"$1\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=\"--dissociate\"\n+\t\t\t;;\n \t\t-m|--merge)\n \t\t\tupdate=\"merge\"\n \t\t\t;;\n@@ -550,6 +557,7 @@ cmd_update()\n \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n \t\t${update:+--update \"$update\"} \\\n \t\t${reference:+\"$reference\"} \\\n+\t\t${dissociate:+\"$dissociate\"} \\\n \t\t${depth:+--depth \"$depth\"} \\\n \t\t${recommend_shallow:+\"$recommend_shallow\"} \\\n \t\t${jobs:+$jobs} \\\ndiff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\nindex e159fc503..ee9772e0a 100755\n--- a/t/t7408-submodule-reference.sh\n+++ b/t/t7408-submodule-reference.sh\n@@ -59,6 +59,16 @@ test_expect_success 'submodule add --reference uses alternates' '\n \ttest_alternate_is_used super/.git/modules/sub/objects/info/alternates super/sub\n '\n \n+test_expect_success 'submodule add --reference with --dissociate doesnt use alternates' '\n+\t(\n+\t\tcd super &&\n+\t\tgit submodule add --reference ../B --dissociate \"file://$base_dir/A\" sub-dissociate &&\n+\t\tgit commit -m B-super-added &&\n+\t\tgit repack -ad\n+\t) &&\n+\ttest_must_fail test_alternate_is_used super/.git/modules/sub-dissociate/objects/info/alternates super/sub-dissociate\n+'\n+\n test_expect_success 'that reference gets used with add' '\n \t(\n \t\tcd super/sub &&\n@@ -82,6 +92,13 @@ test_expect_success 'updating superproject keeps alternates' '\n \ttest_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n '\n \n+test_expect_success 'updating superproject with --dissociate doesnt keep alternates' '\n+\ttest_when_finished \"rm -rf super-clone\" &&\n+\tgit clone super super-clone &&\n+\tgit -C super-clone submodule update --init --reference ../B --dissociate &&\n+\ttest_must_fail test_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n+'\n+\n test_expect_success 'submodules use alternates when cloning a superproject' '\n \ttest_when_finished \"rm -rf super-clone\" &&\n \tgit clone --reference super --recursive super super-clone &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346306","messageId":"CAGZ79kaMOxuqC5nF=Tq+cQtj03fxzoKKnYi_BM23n_hmrTFkfg@mail.gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-1-kcghost@gmail.com","subject":"Re: [PATCH 0/2] Add --progress and --dissociate to git submodule","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-05-01T18:20:35Z","receivedAt":"2018-05-01T18:20:40Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Hi Casey,\n\nthanks for sending those patches and improving submodules!\n\nOn Tue, May 1, 2018 at 11:09 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> These patches add --progress and --dissociate options to git submodule.\n>\n> The --progress option existed beforehand, but only for the update command and\n> it was left undocumented.\n>\n> Both add and update submodule commands supported --reference, but not its pair\n> option --dissociate which allows for independent clones rather than depending\n> on the reference.\n\nThis makes sense.\n\n>\n> I apologize for any errors I may have made in creation of these patches or the\n> formatting of these emails. This is the first time I have submitted patches to\n> a mailing list.\n\nThe formatting seems to be alright, git-format-patch/git-send-email\njust works. ;)\n\nStefan\n"},{"id":"346318","messageId":"CAGZ79kbmVMgLWg8nW9Jnwie0vbfov7PaujMPeVr1oq5o24hcDw@mail.gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-2-kcghost@gmail.com","subject":"Re: [PATCH 1/2] submodule: Add --progress option to add command","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-05-01T18:41:12Z","receivedAt":"2018-05-01T18:41:36Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, May 1, 2018 at 11:09 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> --progress was missing from add command, was only in update.\n> Add --progress where it makes sense (both clone helper commands).\n> Add missing documentation entry.\n> Add test.\n\nMaybe:\n  The '--progress' was introduced in 72c5f88311d (clone: pass --progress\n  decision to recursive submodules, 2016-09-22) to fix the progress reporting\n  of the clone command. Also add the progress option to the 'submodule add'\n  command. The update command already support the progress flag, but it\n  is not documented.\n\n> @@ -117,6 +117,9 @@ cmd_add()\n>                 -q|--quiet)\n>                         GIT_QUIET=1\n>                         ;;\n> +               --progress)\n> +                       progress=\"--progress\"\n> +                       ;;\n\nThe code looks good, though unlike the other commands progress is a\nboolean decision.\n\nIf we want to support --no-progress as well, we can do so by adding\n    --no-progress)\n        progress=\"--no-progress\"\n        ;;\nand then the submodule helper ought to cope with it.\n\n\n> +test_expect_success 'setup test repo' '\n> +       mkdir parent &&\n> +       (cd parent && git init &&\n> +        echo one >file && git add file &&\n> +        git commit -m one)\n> +'\n\nCoding style:\n    (\n        parens open on its own line, and its contents\n        are indented by a tab.\n\nInstead of coding this yourself, you could write the\ntest as:\n\n    test_create_repo parent &&\n    test_create_commit -C parent one\n\n> +test_expect_success 'clone -o' '\n\nWhat are we testing here? I do not quite see the connection to\ntesting --progress here.\n\n> +       git clone -o foo parent clone-o &&\n> +       (cd clone-o && git rev-parse --verify refs/remotes/foo/master)\n\n\n> +test_expect_success 'redirected submodule add does not show progress' '\n> +       (\n> +               cd addtest &&\n\n\n\n> +               git submodule add \"file://$submodurl/parent\" submod-redirected \\\n> +                       >out 2>err &&\n> +               ! grep % err &&\n\nWe're grepping for percent to see that there is no progress. At first I thought\nthe percent sign might be a special character, had to research it to know it's\nmeant literally. TiL!\n\n> +               test_i18ngrep ! \"Checking connectivity\" err\n\nMakes sense.\n\n> +       )\n\nWe could omit the extra shell by using\n\n    git -C addtest submodule add \"file://$... \\\n            >../out 2>../err &&\n\nWhy do we need 'out' ?\n\n> +test_expect_success 'redirected submodule add --progress does show progress' '\n> +       (\n> +               cd addtest &&\n> +               git submodule add --progress \"file://$submodurl/parent\" \\\n> +                       submod-redirected-progress >out 2>err && \\\n> +               grep % err\n> +       )\n> +'\n\nThanks for writing these tests!\nStefan\n"},{"id":"346325","messageId":"CAGZ79kY686ptTPY8DVwr79F2vC6eC_BP=5M7isu9Gfu+eX7vDg@mail.gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-3-kcghost@gmail.com","subject":"Re: [PATCH 2/2] submodule: Add --dissociate option to add/update commands","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-05-01T20:23:09Z","receivedAt":"2018-05-01T20:23:13Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, May 1, 2018 at 11:09 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>\n> +test_expect_success 'submodule add --reference with --dissociate doesnt use alternates' '\n> +       (\n> +               cd super &&\n> +               git submodule add --reference ../B --dissociate \"file://$base_dir/A\" sub-dissociate &&\n> +               git commit -m B-super-added &&\n> +               git repack -ad\n> +       ) &&\n> +       test_must_fail test_alternate_is_used super/.git/modules/sub-dissociate/objects/info/alternates super/sub-dissociate\n\nWe do already have the unfortunate precedent of using \"test_must_fail\ntest_alternate_is_used\"\n(and it was partially included by me in 31224cbdc72 (clone: recursive\nand reference option\ntriggers submodule alternates, 2016-08-17), further used in\nbf03b790471 (submodule--helper:\nset alternateLocation for cloned submodules, 2016-12-08).\n\nI think it is the wrong approach though, as the test_must_fail only ensure that\n*something* doesn't return success. Usually we use it with\n\"test_must_fail git ...\"\nto ensure we properly error out on user requests, that are impossible\nto fulfill in\nthe current implementation.\n\nFor this test case I'd suggest we rather test that the no alternate is setup,\n\n    test_path_is_missing\nsuper/.git/modules/sub-dissociate/objects/info/alternates\n\nas that tests the correctness of the --dissociate option?\n\nThanks,\nStefan\n"},{"id":"346326","messageId":"CAPig+cSbOsdibX588ObTG5_O=Mmp1+pbxiaUFMx-P0jFLLUuHQ@mail.gmail.com","threadId":"48381","inReplyTo":"20180501180908.17443-3-kcghost@gmail.com","subject":"Re: [PATCH 2/2] submodule: Add --dissociate option to add/update commands","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-05-01T20:25:25Z","receivedAt":"2018-05-01T20:25:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, May 1, 2018 at 2:09 PM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> submodule: Add --dissociate option to add/update commands\n\ns/Add/add/\n\n> Add --dissociate option to add and update commands, both clone helper commands\n> that already have the --reference option --dissociate pairs with.\n> Add documentation.\n> Add tests.\n>\n> Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n> ---\n> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\n> @@ -1075,6 +1075,9 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n> +       if (dissociate) {\n> +               argv_array_push(&cp.args, \"--dissociate\");\n> +       }\n\nStyle: drop unnecessary braces\n\n> @@ -1208,6 +1212,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n> +               OPT_BOOL(0, \"dissociate\", &dissociate,\n> +                          N_(\"use --reference only while cloning\")),\n\ns/reference/dissociate/\n\n> @@ -1575,6 +1584,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n> +               OPT_BOOL(0, \"dissociate\", &suc.dissociate,\n> +                          N_(\"use --reference only while cloning\")),\n\ns/reference/dissociate/\n\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> +               --dissociate)\n> +                       dissociate=\"--dissociate\"\n> @@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n> -               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n> +               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"$dissociate\"} ${depth:+\"$depth\"} || exit\n\nI realize that you're just following existing practice in this script,\nbut it's a bit off-putting to see expansions for the new --progress\nand --dissociate options being done via unnecessarily complex\n${foobar:+\"$foobar\"} when the simpler $foobar would work just as well.\n\nJust a comment; not necessarily a request for change. (A separate\npreparatory cleanup patch which simplifies the existing complex\nexpansion expressions would be welcome but could also be considered\noutside the scope of this patch series.)\n\n> @@ -493,6 +497,9 @@ cmd_update()\n> +               --dissociate)\n> +                       dissociate=\"--dissociate\"\n> +                       ;;\n> @@ -550,6 +557,7 @@ cmd_update()\n>                 ${reference:+\"$reference\"} \\\n> +               ${dissociate:+\"$dissociate\"} \\\n>                 ${depth:+--depth \"$depth\"} \\\n"},{"id":"346328","messageId":"CAEp-SHXURpp3XuyHv-pNERRE8WK+o5ao8E2htDA3gdYZGAz5vA@mail.gmail.com","threadId":"48381","inReplyTo":"CAGZ79kbmVMgLWg8nW9Jnwie0vbfov7PaujMPeVr1oq5o24hcDw@mail.gmail.com","subject":"Re: [PATCH 1/2] submodule: Add --progress option to add command","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-01T20:48:49Z","receivedAt":"2018-05-01T20:48:54Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Thanks, I'll clean it up based on your comments. I based the tests\nfrom t5606-clone-options.sh; I'm not sure why now but I thought I\nneeded that clone -o thing from there, but it appears useless.\n\n\n\nOn Tue, May 1, 2018 at 2:41 PM, Stefan Beller <sbeller@google.com> wrote:\n> On Tue, May 1, 2018 at 11:09 AM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>> --progress was missing from add command, was only in update.\n>> Add --progress where it makes sense (both clone helper commands).\n>> Add missing documentation entry.\n>> Add test.\n>\n> Maybe:\n>   The '--progress' was introduced in 72c5f88311d (clone: pass --progress\n>   decision to recursive submodules, 2016-09-22) to fix the progress reporting\n>   of the clone command. Also add the progress option to the 'submodule add'\n>   command. The update command already support the progress flag, but it\n>   is not documented.\n>\n>> @@ -117,6 +117,9 @@ cmd_add()\n>>                 -q|--quiet)\n>>                         GIT_QUIET=1\n>>                         ;;\n>> +               --progress)\n>> +                       progress=\"--progress\"\n>> +                       ;;\n>\n> The code looks good, though unlike the other commands progress is a\n> boolean decision.\n>\n> If we want to support --no-progress as well, we can do so by adding\n>     --no-progress)\n>         progress=\"--no-progress\"\n>         ;;\n> and then the submodule helper ought to cope with it.\n>\n>\n>> +test_expect_success 'setup test repo' '\n>> +       mkdir parent &&\n>> +       (cd parent && git init &&\n>> +        echo one >file && git add file &&\n>> +        git commit -m one)\n>> +'\n>\n> Coding style:\n>     (\n>         parens open on its own line, and its contents\n>         are indented by a tab.\n>\n> Instead of coding this yourself, you could write the\n> test as:\n>\n>     test_create_repo parent &&\n>     test_create_commit -C parent one\n>\n>> +test_expect_success 'clone -o' '\n>\n> What are we testing here? I do not quite see the connection to\n> testing --progress here.\n>\n>> +       git clone -o foo parent clone-o &&\n>> +       (cd clone-o && git rev-parse --verify refs/remotes/foo/master)\n>\n>\n>> +test_expect_success 'redirected submodule add does not show progress' '\n>> +       (\n>> +               cd addtest &&\n>\n>\n>\n>> +               git submodule add \"file://$submodurl/parent\" submod-redirected \\\n>> +                       >out 2>err &&\n>> +               ! grep % err &&\n>\n> We're grepping for percent to see that there is no progress. At first I thought\n> the percent sign might be a special character, had to research it to know it's\n> meant literally. TiL!\n>\n>> +               test_i18ngrep ! \"Checking connectivity\" err\n>\n> Makes sense.\n>\n>> +       )\n>\n> We could omit the extra shell by using\n>\n>     git -C addtest submodule add \"file://$... \\\n>             >../out 2>../err &&\n>\n> Why do we need 'out' ?\n>\n>> +test_expect_success 'redirected submodule add --progress does show progress' '\n>> +       (\n>> +               cd addtest &&\n>> +               git submodule add --progress \"file://$submodurl/parent\" \\\n>> +                       submod-redirected-progress >out 2>err && \\\n>> +               grep % err\n>> +       )\n>> +'\n>\n> Thanks for writing these tests!\n> Stefan\n"},{"id":"346329","messageId":"CAEp-SHWwOin9dbLpYaX+5UFRWpGP=k7zHU_a54AEMc6C9FDCAw@mail.gmail.com","threadId":"48381","inReplyTo":"CAPig+cSbOsdibX588ObTG5_O=Mmp1+pbxiaUFMx-P0jFLLUuHQ@mail.gmail.com","subject":"Re: [PATCH 2/2] submodule: Add --dissociate option to add/update commands","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-01T21:21:18Z","receivedAt":"2018-05-01T21:21:23Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Thanks, I will clean up the braces and commit message.\n\nI have to disagree with the 's/reference/dissociate/' comments. It\nappears this section of option descriptions mostly copies from the\ndescriptions given by 'git clone -h', which outputs:\n    --reference <repo>    reference repository\n    --reference-if-able <repo>\n                          reference repository\n    --dissociate          use --reference only while cloning\nIt is perhaps not the best description, but it means to say when\n--dissociate is used --reference is only in play for reducing network\ntransfer, not keeping alternates.\n\nThose expansions *are* certainly off-putting, they make a long line\neven more difficult to parse. I just searched that file for \":+\" for\nthose types of expressions and I think a patch to fix them would be\nfairly short. I'll look into making that cleanup patch.\n\n\n\nOn Tue, May 1, 2018 at 4:25 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Tue, May 1, 2018 at 2:09 PM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>> submodule: Add --dissociate option to add/update commands\n>\n> s/Add/add/\n>\n>> Add --dissociate option to add and update commands, both clone helper commands\n>> that already have the --reference option --dissociate pairs with.\n>> Add documentation.\n>> Add tests.\n>>\n>> Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n>> ---\n>> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\n>> @@ -1075,6 +1075,9 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n>> +       if (dissociate) {\n>> +               argv_array_push(&cp.args, \"--dissociate\");\n>> +       }\n>\n> Style: drop unnecessary braces\n>\n>> @@ -1208,6 +1212,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n>> +               OPT_BOOL(0, \"dissociate\", &dissociate,\n>> +                          N_(\"use --reference only while cloning\")),\n>\n> s/reference/dissociate/\n>\n>> @@ -1575,6 +1584,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n>> +               OPT_BOOL(0, \"dissociate\", &suc.dissociate,\n>> +                          N_(\"use --reference only while cloning\")),\n>\n> s/reference/dissociate/\n>\n>> diff --git a/git-submodule.sh b/git-submodule.sh\n>> +               --dissociate)\n>> +                       dissociate=\"--dissociate\"\n>> @@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n>> -               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n>> +               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"$progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"$dissociate\"} ${depth:+\"$depth\"} || exit\n>\n> I realize that you're just following existing practice in this script,\n> but it's a bit off-putting to see expansions for the new --progress\n> and --dissociate options being done via unnecessarily complex\n> ${foobar:+\"$foobar\"} when the simpler $foobar would work just as well.\n>\n> Just a comment; not necessarily a request for change. (A separate\n> preparatory cleanup patch which simplifies the existing complex\n> expansion expressions would be welcome but could also be considered\n> outside the scope of this patch series.)\n>\n>> @@ -493,6 +497,9 @@ cmd_update()\n>> +               --dissociate)\n>> +                       dissociate=\"--dissociate\"\n>> +                       ;;\n>> @@ -550,6 +557,7 @@ cmd_update()\n>>                 ${reference:+\"$reference\"} \\\n>> +               ${dissociate:+\"$dissociate\"} \\\n>>                 ${depth:+--depth \"$depth\"} \\\n"},{"id":"346401","messageId":"20180502002759.8207-1-kcghost@gmail.com","threadId":"48381","inReplyTo":"CAEp-SHV4hP=v_=AJExRS3hqT-x9rXEONofWD=sVQZC79uewATA@mail.gmail.com","subject":"[PATCH 0/3] Add --progress and --dissociate to git submodule","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:27:56Z","receivedAt":"2018-05-02T00:31:00Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"These patches add --progress and --dissociate options to git submodule.\n\nThe --progress option existed beforehand, but only for the update command and\nit was left undocumented.\n\nBoth add and update submodule commands supported --reference, but not its pair\noption --dissociate which allows for independent clones rather than depending\non the reference.\n\nThis is a resubmission with comments from Stefan Beller and Eric Sunshine\naddressed.\n\nCasey Fitzpatrick (3):\n  submodule: clean up subsititions in script\n  submodule: add --progress option to add command\n  submodule: add --dissociate option to add/update commands\n\n Documentation/git-submodule.txt | 17 ++++++++++++++++-\n builtin/submodule--helper.c     | 16 +++++++++++++---\n git-submodule.sh                | 21 ++++++++++++++++-----\n t/t7400-submodule-basic.sh      | 16 ++++++++++++++++\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 5 files changed, 78 insertions(+), 9 deletions(-)\n\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346402","messageId":"20180502002759.8207-2-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502002759.8207-1-kcghost@gmail.com","subject":"[PATCH 1/3] submodule: clean up subsititions in script","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:27:57Z","receivedAt":"2018-05-02T00:31:04Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"'recommend_shallow' and 'jobs' variables do not need quotes (they never contain\nspaces) and do not require any additional prefix, therefore remove the\nunnecessary subsitition.\n\n'progress' is a boolean value. Treat it like the other boolean values in the\nscript by using a substitution.\n---\n git-submodule.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 24914963c..262547968 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -465,7 +465,7 @@ cmd_update()\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n \t\t--progress)\n-\t\t\tprogress=\"--progress\"\n+\t\t\tprogress=1\n \t\t\t;;\n \t\t-i|--init)\n \t\t\tinit=1\n@@ -542,14 +542,14 @@ cmd_update()\n \n \t{\n \tgit submodule--helper update-clone ${GIT_QUIET:+--quiet} \\\n-\t\t${progress:+\"$progress\"} \\\n+\t\t${progress:+\"--progress\"} \\\n \t\t${wt_prefix:+--prefix \"$wt_prefix\"} \\\n \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n \t\t${update:+--update \"$update\"} \\\n \t\t${reference:+\"$reference\"} \\\n \t\t${depth:+--depth \"$depth\"} \\\n-\t\t${recommend_shallow:+\"$recommend_shallow\"} \\\n-\t\t${jobs:+$jobs} \\\n+\t\t$recommend_shallow \\\n+\t\t$jobs \\\n \t\t\"$@\" || echo \"#unmatched\" $?\n \t} | {\n \terr=\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346403","messageId":"20180502002759.8207-3-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502002759.8207-1-kcghost@gmail.com","subject":"[PATCH 2/3] submodule: add --progress option to add command","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:27:58Z","receivedAt":"2018-05-02T00:31:07Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"The '--progress' was introduced in 72c5f88311d (clone: pass --progress\ndecision to recursive submodules, 2016-09-22) to fix the progress reporting\nof the clone command. Also add the progress option to the 'submodule add'\ncommand. The update command already supports the progress flag, but it\nis not documented.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt |  7 +++++++\n git-submodule.sh                |  5 ++++-\n t/t7400-submodule-basic.sh      | 16 ++++++++++++++++\n 3 files changed, 27 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex 71c5618e8..d1ebe32e8 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -239,6 +239,13 @@ OPTIONS\n --quiet::\n \tOnly print error messages.\n \n+--progress::\n+\tThis option is only valid for add and update commands.\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless -q\n+\tis specified. This flag forces progress status even if the\n+\tstandard error stream is not directed to a terminal.\n+\n --all::\n \tThis option is only valid for the deinit command. Unregister all\n \tsubmodules in the working tree.\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 262547968..39c241a1d 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -117,6 +117,9 @@ cmd_add()\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n+\t\t--progress)\n+\t\t\tprogress=1\n+\t\t\t;;\n \t\t--reference)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\treference_path=$2\n@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex a39e69a3e..b5b4922ab 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -126,6 +126,22 @@ test_expect_success 'submodule add' '\n \ttest_cmp empty untracked\n '\n \n+test_create_repo parent &&\n+test_commit -C parent one\n+\n+test_expect_success 'redirected submodule add does not show progress' '\n+\tgit -C addtest submodule add \"file://$submodurl/parent\" submod-redirected \\\n+\t\t2>err &&\n+\t! grep % err &&\n+\ttest_i18ngrep ! \"Checking connectivity\" err\n+'\n+\n+test_expect_success 'redirected submodule add --progress does show progress' '\n+\tgit -C addtest submodule add --progress \"file://$submodurl/parent\" \\\n+\t\tsubmod-redirected-progress 2>err && \\\n+\tgrep % err\n+'\n+\n test_expect_success 'submodule add to .gitignored path fails' '\n \t(\n \t\tcd addtest-ignore &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346404","messageId":"20180502002759.8207-4-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502002759.8207-1-kcghost@gmail.com","subject":"[PATCH 3/3] submodule: add --dissociate option to add/update commands","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:27:59Z","receivedAt":"2018-05-02T00:31:09Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Add --dissociate option to add and update commands, both clone helper commands\nthat already have the --reference option --dissociate pairs with.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt | 10 +++++++++-\n builtin/submodule--helper.c     | 16 +++++++++++++---\n git-submodule.sh                | 10 +++++++++-\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 4 files changed, 48 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex d1ebe32e8..a75b95043 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -369,7 +369,15 @@ the submodule itself.\n \tthis option will be passed to the linkgit:git-clone[1] command.\n +\n *NOTE*: Do *not* use this option unless you have read the note\n-for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.\n+for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`\n+options carefully.\n+\n+--dissociate::\n+\tThis option is only valid for add and update commands.  These\n+\tcommands sometimes need to clone a remote repository. In this case,\n+\tthis option will be passed to the linkgit:git-clone[1] command.\n++\n+*NOTE*: see the NOTE for the `--reference` option.\n \n --recursive::\n \tThis option is only valid for foreach, update, status and sync commands.\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 6ba8587b6..a85b30419 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1056,7 +1056,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)\n }\n \n static int clone_submodule(const char *path, const char *gitdir, const char *url,\n-\t\t\t   const char *depth, struct string_list *reference,\n+\t\t\t   const char *depth, struct string_list *reference, int dissociate,\n \t\t\t   int quiet, int progress)\n {\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -1075,6 +1075,8 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n \t\t\targv_array_pushl(&cp.args, \"--reference\",\n \t\t\t\t\t item->string, NULL);\n \t}\n+\tif (dissociate)\n+\t\targv_array_push(&cp.args, \"--dissociate\");\n \tif (gitdir && *gitdir)\n \t\targv_array_pushl(&cp.args, \"--separate-git-dir\", gitdir, NULL);\n \n@@ -1190,6 +1192,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \tchar *p, *path = NULL, *sm_gitdir;\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct string_list reference = STRING_LIST_INIT_NODUP;\n+\tint dissociate = 0;\n \tchar *sm_alternate = NULL, *error_strategy = NULL;\n \n \tstruct option module_clone_options[] = {\n@@ -1208,6 +1211,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING_LIST(0, \"reference\", &reference,\n \t\t\t   N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &depth,\n \t\t\t   N_(\"string\"),\n \t\t\t   N_(\"depth for shallow clones\")),\n@@ -1247,7 +1252,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \n \t\tprepare_possible_alternates(name, &reference);\n \n-\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference,\n+\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference, dissociate,\n \t\t\t\t    quiet, progress))\n \t\t\tdie(_(\"clone of '%s' into submodule path '%s' failed\"),\n \t\t\t    url, path);\n@@ -1300,6 +1305,7 @@ struct submodule_update_clone {\n \tint quiet;\n \tint recommend_shallow;\n \tstruct string_list references;\n+\tint dissociate;\n \tconst char *depth;\n \tconst char *recursive_prefix;\n \tconst char *prefix;\n@@ -1315,7 +1321,7 @@ struct submodule_update_clone {\n \tint failed_clones_nr, failed_clones_alloc;\n };\n #define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \\\n-\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \\\n+\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \\\n \tNULL, NULL, NULL, \\\n \tSTRING_LIST_INIT_DUP, 0, NULL, 0, 0}\n \n@@ -1442,6 +1448,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n \t\tfor_each_string_list_item(item, &suc->references)\n \t\t\targv_array_pushl(&child->args, \"--reference\", item->string, NULL);\n \t}\n+\tif (suc->dissociate)\n+\t\targv_array_push(&child->args, \"--dissociate\");\n \tif (suc->depth)\n \t\targv_array_push(&child->args, suc->depth);\n \n@@ -1575,6 +1583,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n \t\t\t   N_(\"rebase, merge, checkout or none\")),\n \t\tOPT_STRING_LIST(0, \"reference\", &suc.references, N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &suc.dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &suc.depth, \"<depth>\",\n \t\t\t   N_(\"Create a shallow clone truncated to the \"\n \t\t\t      \"specified number of revisions\")),\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 39c241a1d..1fddc098f 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -42,6 +42,7 @@ prefix=\n custom_name=\n depth=\n progress=\n+dissociate=\n \n die_if_unmatched ()\n {\n@@ -128,6 +129,9 @@ cmd_add()\n \t\t--reference=*)\n \t\t\treference_path=\"${1#--reference=}\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=1\n+\t\t\t;;\n \t\t--name)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\tcustom_name=$2\n@@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"--dissociate\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\n@@ -493,6 +497,9 @@ cmd_update()\n \t\t--reference=*)\n \t\t\treference=\"$1\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=1\n+\t\t\t;;\n \t\t-m|--merge)\n \t\t\tupdate=\"merge\"\n \t\t\t;;\n@@ -550,6 +557,7 @@ cmd_update()\n \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n \t\t${update:+--update \"$update\"} \\\n \t\t${reference:+\"$reference\"} \\\n+\t\t${dissociate:+\"--dissociate\"} \\\n \t\t${depth:+--depth \"$depth\"} \\\n \t\t$recommend_shallow \\\n \t\t$jobs \\\ndiff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\nindex e159fc503..1b3e7c2f7 100755\n--- a/t/t7408-submodule-reference.sh\n+++ b/t/t7408-submodule-reference.sh\n@@ -59,6 +59,16 @@ test_expect_success 'submodule add --reference uses alternates' '\n \ttest_alternate_is_used super/.git/modules/sub/objects/info/alternates super/sub\n '\n \n+test_expect_success 'submodule add --reference with --dissociate doesnt use alternates' '\n+\t(\n+\t\tcd super &&\n+\t\tgit submodule add --reference ../B --dissociate \"file://$base_dir/A\" sub-dissociate &&\n+\t\tgit commit -m B-super-added &&\n+\t\tgit repack -ad\n+\t) &&\n+\ttest_path_is_missing super/.git/modules/sub-dissociate/objects/info/alternates\n+'\n+\n test_expect_success 'that reference gets used with add' '\n \t(\n \t\tcd super/sub &&\n@@ -82,6 +92,13 @@ test_expect_success 'updating superproject keeps alternates' '\n \ttest_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n '\n \n+test_expect_success 'updating superproject with --dissociate doesnt keep alternates' '\n+\ttest_when_finished \"rm -rf super-clone\" &&\n+\tgit clone super super-clone &&\n+\tgit -C super-clone submodule update --init --reference ../B --dissociate &&\n+\ttest_must_fail test_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n+'\n+\n test_expect_success 'submodules use alternates when cloning a superproject' '\n \ttest_when_finished \"rm -rf super-clone\" &&\n \tgit clone --reference super --recursive super super-clone &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346409","messageId":"CAEp-SHXmWv=peu3-j3AodAhwAPgyPNVrTE4DJuFcr0mTn2M3iw@mail.gmail.com","threadId":"48381","inReplyTo":"20180502002759.8207-4-kcghost@gmail.com","subject":"Re: [PATCH 3/3] submodule: add --dissociate option to add/update commands","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:40:22Z","receivedAt":"2018-05-02T00:40:27Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Just noticed I missed the other 'test_must_fail'. Resubmitting in a few moments.\n\nOn Tue, May 1, 2018 at 8:27 PM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n> Add --dissociate option to add and update commands, both clone helper commands\n> that already have the --reference option --dissociate pairs with.\n>\n> Signed-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n> ---\n>  Documentation/git-submodule.txt | 10 +++++++++-\n>  builtin/submodule--helper.c     | 16 +++++++++++++---\n>  git-submodule.sh                | 10 +++++++++-\n>  t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n>  4 files changed, 48 insertions(+), 5 deletions(-)\n>\n> diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\n> index d1ebe32e8..a75b95043 100644\n> --- a/Documentation/git-submodule.txt\n> +++ b/Documentation/git-submodule.txt\n> @@ -369,7 +369,15 @@ the submodule itself.\n>         this option will be passed to the linkgit:git-clone[1] command.\n>  +\n>  *NOTE*: Do *not* use this option unless you have read the note\n> -for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.\n> +for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`\n> +options carefully.\n> +\n> +--dissociate::\n> +       This option is only valid for add and update commands.  These\n> +       commands sometimes need to clone a remote repository. In this case,\n> +       this option will be passed to the linkgit:git-clone[1] command.\n> ++\n> +*NOTE*: see the NOTE for the `--reference` option.\n>\n>  --recursive::\n>         This option is only valid for foreach, update, status and sync commands.\n> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\n> index 6ba8587b6..a85b30419 100644\n> --- a/builtin/submodule--helper.c\n> +++ b/builtin/submodule--helper.c\n> @@ -1056,7 +1056,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)\n>  }\n>\n>  static int clone_submodule(const char *path, const char *gitdir, const char *url,\n> -                          const char *depth, struct string_list *reference,\n> +                          const char *depth, struct string_list *reference, int dissociate,\n>                            int quiet, int progress)\n>  {\n>         struct child_process cp = CHILD_PROCESS_INIT;\n> @@ -1075,6 +1075,8 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n>                         argv_array_pushl(&cp.args, \"--reference\",\n>                                          item->string, NULL);\n>         }\n> +       if (dissociate)\n> +               argv_array_push(&cp.args, \"--dissociate\");\n>         if (gitdir && *gitdir)\n>                 argv_array_pushl(&cp.args, \"--separate-git-dir\", gitdir, NULL);\n>\n> @@ -1190,6 +1192,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n>         char *p, *path = NULL, *sm_gitdir;\n>         struct strbuf sb = STRBUF_INIT;\n>         struct string_list reference = STRING_LIST_INIT_NODUP;\n> +       int dissociate = 0;\n>         char *sm_alternate = NULL, *error_strategy = NULL;\n>\n>         struct option module_clone_options[] = {\n> @@ -1208,6 +1211,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n>                 OPT_STRING_LIST(0, \"reference\", &reference,\n>                            N_(\"repo\"),\n>                            N_(\"reference repository\")),\n> +               OPT_BOOL(0, \"dissociate\", &dissociate,\n> +                          N_(\"use --reference only while cloning\")),\n>                 OPT_STRING(0, \"depth\", &depth,\n>                            N_(\"string\"),\n>                            N_(\"depth for shallow clones\")),\n> @@ -1247,7 +1252,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n>\n>                 prepare_possible_alternates(name, &reference);\n>\n> -               if (clone_submodule(path, sm_gitdir, url, depth, &reference,\n> +               if (clone_submodule(path, sm_gitdir, url, depth, &reference, dissociate,\n>                                     quiet, progress))\n>                         die(_(\"clone of '%s' into submodule path '%s' failed\"),\n>                             url, path);\n> @@ -1300,6 +1305,7 @@ struct submodule_update_clone {\n>         int quiet;\n>         int recommend_shallow;\n>         struct string_list references;\n> +       int dissociate;\n>         const char *depth;\n>         const char *recursive_prefix;\n>         const char *prefix;\n> @@ -1315,7 +1321,7 @@ struct submodule_update_clone {\n>         int failed_clones_nr, failed_clones_alloc;\n>  };\n>  #define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \\\n> -       SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \\\n> +       SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \\\n>         NULL, NULL, NULL, \\\n>         STRING_LIST_INIT_DUP, 0, NULL, 0, 0}\n>\n> @@ -1442,6 +1448,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n>                 for_each_string_list_item(item, &suc->references)\n>                         argv_array_pushl(&child->args, \"--reference\", item->string, NULL);\n>         }\n> +       if (suc->dissociate)\n> +               argv_array_push(&child->args, \"--dissociate\");\n>         if (suc->depth)\n>                 argv_array_push(&child->args, suc->depth);\n>\n> @@ -1575,6 +1583,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n>                            N_(\"rebase, merge, checkout or none\")),\n>                 OPT_STRING_LIST(0, \"reference\", &suc.references, N_(\"repo\"),\n>                            N_(\"reference repository\")),\n> +               OPT_BOOL(0, \"dissociate\", &suc.dissociate,\n> +                          N_(\"use --reference only while cloning\")),\n>                 OPT_STRING(0, \"depth\", &suc.depth, \"<depth>\",\n>                            N_(\"Create a shallow clone truncated to the \"\n>                               \"specified number of revisions\")),\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 39c241a1d..1fddc098f 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -42,6 +42,7 @@ prefix=\n>  custom_name=\n>  depth=\n>  progress=\n> +dissociate=\n>\n>  die_if_unmatched ()\n>  {\n> @@ -128,6 +129,9 @@ cmd_add()\n>                 --reference=*)\n>                         reference_path=\"${1#--reference=}\"\n>                         ;;\n> +               --dissociate)\n> +                       dissociate=1\n> +                       ;;\n>                 --name)\n>                         case \"$2\" in '') usage ;; esac\n>                         custom_name=$2\n> @@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n>                                 eval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n>                         fi\n>                 fi\n> -               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n> +               git submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"--dissociate\"} ${depth:+\"$depth\"} || exit\n>                 (\n>                         sanitize_submodule_env\n>                         cd \"$sm_path\" &&\n> @@ -493,6 +497,9 @@ cmd_update()\n>                 --reference=*)\n>                         reference=\"$1\"\n>                         ;;\n> +               --dissociate)\n> +                       dissociate=1\n> +                       ;;\n>                 -m|--merge)\n>                         update=\"merge\"\n>                         ;;\n> @@ -550,6 +557,7 @@ cmd_update()\n>                 ${prefix:+--recursive-prefix \"$prefix\"} \\\n>                 ${update:+--update \"$update\"} \\\n>                 ${reference:+\"$reference\"} \\\n> +               ${dissociate:+\"--dissociate\"} \\\n>                 ${depth:+--depth \"$depth\"} \\\n>                 $recommend_shallow \\\n>                 $jobs \\\n> diff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\n> index e159fc503..1b3e7c2f7 100755\n> --- a/t/t7408-submodule-reference.sh\n> +++ b/t/t7408-submodule-reference.sh\n> @@ -59,6 +59,16 @@ test_expect_success 'submodule add --reference uses alternates' '\n>         test_alternate_is_used super/.git/modules/sub/objects/info/alternates super/sub\n>  '\n>\n> +test_expect_success 'submodule add --reference with --dissociate doesnt use alternates' '\n> +       (\n> +               cd super &&\n> +               git submodule add --reference ../B --dissociate \"file://$base_dir/A\" sub-dissociate &&\n> +               git commit -m B-super-added &&\n> +               git repack -ad\n> +       ) &&\n> +       test_path_is_missing super/.git/modules/sub-dissociate/objects/info/alternates\n> +'\n> +\n>  test_expect_success 'that reference gets used with add' '\n>         (\n>                 cd super/sub &&\n> @@ -82,6 +92,13 @@ test_expect_success 'updating superproject keeps alternates' '\n>         test_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n>  '\n>\n> +test_expect_success 'updating superproject with --dissociate doesnt keep alternates' '\n> +       test_when_finished \"rm -rf super-clone\" &&\n> +       git clone super super-clone &&\n> +       git -C super-clone submodule update --init --reference ../B --dissociate &&\n> +       test_must_fail test_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n> +'\n> +\n>  test_expect_success 'submodules use alternates when cloning a superproject' '\n>         test_when_finished \"rm -rf super-clone\" &&\n>         git clone --reference super --recursive super super-clone &&\n> --\n> 2.17.0.1.ge0414f29c.dirty\n>\n"},{"id":"346410","messageId":"20180502005528.19740-1-kcghost@gmail.com","threadId":"48381","inReplyTo":"CAEp-SHV4hP=v_=AJExRS3hqT-x9rXEONofWD=sVQZC79uewATA@mail.gmail.com","subject":"[PATCH 0/3] Add --progress and --dissociate to git submodule","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:55:25Z","receivedAt":"2018-05-02T01:04:22Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"These patches add --progress and --dissociate options to git submodule.\n\nThe --progress option existed beforehand, but only for the update command and\nit was left undocumented.\n\nBoth add and update submodule commands supported --reference, but not its pair\noption --dissociate which allows for independent clones rather than depending\non the reference.\n\nThis is a resubmission with comments from Stefan Beller and Eric Sunshine\naddressed.\n\nCasey Fitzpatrick (3):\n  submodule: clean up subsititions in script\n  submodule: add --progress option to add command\n  submodule: add --dissociate option to add/update commands\n\n Documentation/git-submodule.txt | 17 ++++++++++++++++-\n builtin/submodule--helper.c     | 16 +++++++++++++---\n git-submodule.sh                | 21 ++++++++++++++++-----\n t/t7400-submodule-basic.sh      | 16 ++++++++++++++++\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 5 files changed, 78 insertions(+), 9 deletions(-)\n\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346411","messageId":"20180502005528.19740-2-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502005528.19740-1-kcghost@gmail.com","subject":"[PATCH 1/3] submodule: clean up subsititions in script","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:55:26Z","receivedAt":"2018-05-02T01:04:25Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"'recommend_shallow' and 'jobs' variables do not need quotes (they never contain\nspaces) and do not require any additional prefix, therefore remove the\nunnecessary subsitition.\n\n'progress' is a boolean value. Treat it like the other boolean values in the\nscript by using a substitution.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n git-submodule.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 24914963c..262547968 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -465,7 +465,7 @@ cmd_update()\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n \t\t--progress)\n-\t\t\tprogress=\"--progress\"\n+\t\t\tprogress=1\n \t\t\t;;\n \t\t-i|--init)\n \t\t\tinit=1\n@@ -542,14 +542,14 @@ cmd_update()\n \n \t{\n \tgit submodule--helper update-clone ${GIT_QUIET:+--quiet} \\\n-\t\t${progress:+\"$progress\"} \\\n+\t\t${progress:+\"--progress\"} \\\n \t\t${wt_prefix:+--prefix \"$wt_prefix\"} \\\n \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n \t\t${update:+--update \"$update\"} \\\n \t\t${reference:+\"$reference\"} \\\n \t\t${depth:+--depth \"$depth\"} \\\n-\t\t${recommend_shallow:+\"$recommend_shallow\"} \\\n-\t\t${jobs:+$jobs} \\\n+\t\t$recommend_shallow \\\n+\t\t$jobs \\\n \t\t\"$@\" || echo \"#unmatched\" $?\n \t} | {\n \terr=\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346412","messageId":"20180502005528.19740-3-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502005528.19740-1-kcghost@gmail.com","subject":"[PATCH 2/3] submodule: add --progress option to add command","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:55:27Z","receivedAt":"2018-05-02T01:04:27Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"The '--progress' was introduced in 72c5f88311d (clone: pass --progress\ndecision to recursive submodules, 2016-09-22) to fix the progress reporting\nof the clone command. Also add the progress option to the 'submodule add'\ncommand. The update command already supports the progress flag, but it\nis not documented.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt |  7 +++++++\n git-submodule.sh                |  5 ++++-\n t/t7400-submodule-basic.sh      | 16 ++++++++++++++++\n 3 files changed, 27 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex 71c5618e8..d1ebe32e8 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -239,6 +239,13 @@ OPTIONS\n --quiet::\n \tOnly print error messages.\n \n+--progress::\n+\tThis option is only valid for add and update commands.\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless -q\n+\tis specified. This flag forces progress status even if the\n+\tstandard error stream is not directed to a terminal.\n+\n --all::\n \tThis option is only valid for the deinit command. Unregister all\n \tsubmodules in the working tree.\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 262547968..39c241a1d 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -117,6 +117,9 @@ cmd_add()\n \t\t-q|--quiet)\n \t\t\tGIT_QUIET=1\n \t\t\t;;\n+\t\t--progress)\n+\t\t\tprogress=1\n+\t\t\t;;\n \t\t--reference)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\treference_path=$2\n@@ -255,7 +258,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex a39e69a3e..b5b4922ab 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -126,6 +126,22 @@ test_expect_success 'submodule add' '\n \ttest_cmp empty untracked\n '\n \n+test_create_repo parent &&\n+test_commit -C parent one\n+\n+test_expect_success 'redirected submodule add does not show progress' '\n+\tgit -C addtest submodule add \"file://$submodurl/parent\" submod-redirected \\\n+\t\t2>err &&\n+\t! grep % err &&\n+\ttest_i18ngrep ! \"Checking connectivity\" err\n+'\n+\n+test_expect_success 'redirected submodule add --progress does show progress' '\n+\tgit -C addtest submodule add --progress \"file://$submodurl/parent\" \\\n+\t\tsubmod-redirected-progress 2>err && \\\n+\tgrep % err\n+'\n+\n test_expect_success 'submodule add to .gitignored path fails' '\n \t(\n \t\tcd addtest-ignore &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346413","messageId":"20180502005528.19740-4-kcghost@gmail.com","threadId":"48381","inReplyTo":"20180502005528.19740-1-kcghost@gmail.com","subject":"[PATCH 3/3] submodule: add --dissociate option to add/update commands","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T00:55:28Z","receivedAt":"2018-05-02T01:04:30Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Add --dissociate option to add and update commands, both clone helper commands\nthat already have the --reference option --dissociate pairs with.\n\nSigned-off-by: Casey Fitzpatrick <kcghost@gmail.com>\n---\n Documentation/git-submodule.txt | 10 +++++++++-\n builtin/submodule--helper.c     | 16 +++++++++++++---\n git-submodule.sh                | 10 +++++++++-\n t/t7408-submodule-reference.sh  | 17 +++++++++++++++++\n 4 files changed, 48 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex d1ebe32e8..a75b95043 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -369,7 +369,15 @@ the submodule itself.\n \tthis option will be passed to the linkgit:git-clone[1] command.\n +\n *NOTE*: Do *not* use this option unless you have read the note\n-for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.\n+for linkgit:git-clone[1]'s `--reference`, `--shared`, and `--dissociate`\n+options carefully.\n+\n+--dissociate::\n+\tThis option is only valid for add and update commands.  These\n+\tcommands sometimes need to clone a remote repository. In this case,\n+\tthis option will be passed to the linkgit:git-clone[1] command.\n++\n+*NOTE*: see the NOTE for the `--reference` option.\n \n --recursive::\n \tThis option is only valid for foreach, update, status and sync commands.\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 6ba8587b6..a85b30419 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1056,7 +1056,7 @@ static int module_deinit(int argc, const char **argv, const char *prefix)\n }\n \n static int clone_submodule(const char *path, const char *gitdir, const char *url,\n-\t\t\t   const char *depth, struct string_list *reference,\n+\t\t\t   const char *depth, struct string_list *reference, int dissociate,\n \t\t\t   int quiet, int progress)\n {\n \tstruct child_process cp = CHILD_PROCESS_INIT;\n@@ -1075,6 +1075,8 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url\n \t\t\targv_array_pushl(&cp.args, \"--reference\",\n \t\t\t\t\t item->string, NULL);\n \t}\n+\tif (dissociate)\n+\t\targv_array_push(&cp.args, \"--dissociate\");\n \tif (gitdir && *gitdir)\n \t\targv_array_pushl(&cp.args, \"--separate-git-dir\", gitdir, NULL);\n \n@@ -1190,6 +1192,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \tchar *p, *path = NULL, *sm_gitdir;\n \tstruct strbuf sb = STRBUF_INIT;\n \tstruct string_list reference = STRING_LIST_INIT_NODUP;\n+\tint dissociate = 0;\n \tchar *sm_alternate = NULL, *error_strategy = NULL;\n \n \tstruct option module_clone_options[] = {\n@@ -1208,6 +1211,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING_LIST(0, \"reference\", &reference,\n \t\t\t   N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &depth,\n \t\t\t   N_(\"string\"),\n \t\t\t   N_(\"depth for shallow clones\")),\n@@ -1247,7 +1252,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)\n \n \t\tprepare_possible_alternates(name, &reference);\n \n-\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference,\n+\t\tif (clone_submodule(path, sm_gitdir, url, depth, &reference, dissociate,\n \t\t\t\t    quiet, progress))\n \t\t\tdie(_(\"clone of '%s' into submodule path '%s' failed\"),\n \t\t\t    url, path);\n@@ -1300,6 +1305,7 @@ struct submodule_update_clone {\n \tint quiet;\n \tint recommend_shallow;\n \tstruct string_list references;\n+\tint dissociate;\n \tconst char *depth;\n \tconst char *recursive_prefix;\n \tconst char *prefix;\n@@ -1315,7 +1321,7 @@ struct submodule_update_clone {\n \tint failed_clones_nr, failed_clones_alloc;\n };\n #define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \\\n-\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \\\n+\tSUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \\\n \tNULL, NULL, NULL, \\\n \tSTRING_LIST_INIT_DUP, 0, NULL, 0, 0}\n \n@@ -1442,6 +1448,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,\n \t\tfor_each_string_list_item(item, &suc->references)\n \t\t\targv_array_pushl(&child->args, \"--reference\", item->string, NULL);\n \t}\n+\tif (suc->dissociate)\n+\t\targv_array_push(&child->args, \"--dissociate\");\n \tif (suc->depth)\n \t\targv_array_push(&child->args, suc->depth);\n \n@@ -1575,6 +1583,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)\n \t\t\t   N_(\"rebase, merge, checkout or none\")),\n \t\tOPT_STRING_LIST(0, \"reference\", &suc.references, N_(\"repo\"),\n \t\t\t   N_(\"reference repository\")),\n+\t\tOPT_BOOL(0, \"dissociate\", &suc.dissociate,\n+\t\t\t   N_(\"use --reference only while cloning\")),\n \t\tOPT_STRING(0, \"depth\", &suc.depth, \"<depth>\",\n \t\t\t   N_(\"Create a shallow clone truncated to the \"\n \t\t\t      \"specified number of revisions\")),\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 39c241a1d..1fddc098f 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -42,6 +42,7 @@ prefix=\n custom_name=\n depth=\n progress=\n+dissociate=\n \n die_if_unmatched ()\n {\n@@ -128,6 +129,9 @@ cmd_add()\n \t\t--reference=*)\n \t\t\treference_path=\"${1#--reference=}\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=1\n+\t\t\t;;\n \t\t--name)\n \t\t\tcase \"$2\" in '') usage ;; esac\n \t\t\tcustom_name=$2\n@@ -258,7 +262,7 @@ or you are unsure what this means choose another name with the '--name' option.\"\n \t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n-\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n+\t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} ${progress:+\"--progress\"} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${dissociate:+\"--dissociate\"} ${depth:+\"$depth\"} || exit\n \t\t(\n \t\t\tsanitize_submodule_env\n \t\t\tcd \"$sm_path\" &&\n@@ -493,6 +497,9 @@ cmd_update()\n \t\t--reference=*)\n \t\t\treference=\"$1\"\n \t\t\t;;\n+\t\t--dissociate)\n+\t\t\tdissociate=1\n+\t\t\t;;\n \t\t-m|--merge)\n \t\t\tupdate=\"merge\"\n \t\t\t;;\n@@ -550,6 +557,7 @@ cmd_update()\n \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n \t\t${update:+--update \"$update\"} \\\n \t\t${reference:+\"$reference\"} \\\n+\t\t${dissociate:+\"--dissociate\"} \\\n \t\t${depth:+--depth \"$depth\"} \\\n \t\t$recommend_shallow \\\n \t\t$jobs \\\ndiff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\nindex e159fc503..82656747f 100755\n--- a/t/t7408-submodule-reference.sh\n+++ b/t/t7408-submodule-reference.sh\n@@ -59,6 +59,16 @@ test_expect_success 'submodule add --reference uses alternates' '\n \ttest_alternate_is_used super/.git/modules/sub/objects/info/alternates super/sub\n '\n \n+test_expect_success 'submodule add --reference with --dissociate doesnt use alternates' '\n+\t(\n+\t\tcd super &&\n+\t\tgit submodule add --reference ../B --dissociate \"file://$base_dir/A\" sub-dissociate &&\n+\t\tgit commit -m B-super-added &&\n+\t\tgit repack -ad\n+\t) &&\n+\ttest_path_is_missing super/.git/modules/sub-dissociate/objects/info/alternates\n+'\n+\n test_expect_success 'that reference gets used with add' '\n \t(\n \t\tcd super/sub &&\n@@ -82,6 +92,13 @@ test_expect_success 'updating superproject keeps alternates' '\n \ttest_alternate_is_used super-clone/.git/modules/sub/objects/info/alternates super-clone/sub\n '\n \n+test_expect_success 'updating superproject with --dissociate doesnt keep alternates' '\n+\ttest_when_finished \"rm -rf super-clone\" &&\n+\tgit clone super super-clone &&\n+\tgit -C super-clone submodule update --init --reference ../B --dissociate &&\n+\ttest_path_is_missing super-clone/.git/modules/sub/objects/info/alternates\n+'\n+\n test_expect_success 'submodules use alternates when cloning a superproject' '\n \ttest_when_finished \"rm -rf super-clone\" &&\n \tgit clone --reference super --recursive super super-clone &&\n-- \n2.17.0.1.ge0414f29c.dirty\n\n"},{"id":"346422","messageId":"xmqqmuxiwuce.fsf@gitster-ct.c.googlers.com","threadId":"48381","inReplyTo":"CACBZZX4NMJE0kcgb0aB0z3X6yGhL8VJVx6V3tYfA3socbjTQfA@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-02T04:32:33Z","receivedAt":"2018-05-02T04:32:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Mon, Apr 30, 2018 at 1:30 PM, Casey Fitzpatrick <kcghost@gmail.com> wrote:\n>> It also seems to be missing \"--progress\", and I imagine others.\n>> Perhaps submodule add/update should be reworked to automatically\n>> accept all the options that clone would?\n>\n> --progress is not missing, but I see that it isn't documented. It was\n> added in 72c5f88311 (\"clone: pass --progress decision to recursive\n> submodules\", 2016-09-22). What you're suggesting makes sense, but as\n> shown in that commit it's not easy for it to happen automatically,\n> there's a lot of boilerplate involved.\n>\n> But since you're interested you can see how to add new options with\n> that patch, it should be easy for anyone not experienced with the\n> codebase, it's all just boilerplate + adding a test.\n\nI think it is going in the right direction overall, but a few corner\ncases may need special attention.  \"add\" may be adding a new module\nthat locally originates, in which case \"clone\" is not relevant.\nSimilarly, for \"update\"options for \"clone\" are not relevant unless\nit is the very initial one.\n"},{"id":"346423","messageId":"xmqqin86wu8n.fsf@gitster-ct.c.googlers.com","threadId":"48381","inReplyTo":"CAGZ79kZQ3ce8QTJy2Siiuoz=pa6qWweNc8GTpoygkvKuoFXaAA@mail.gmail.com","subject":"Re: git-submodule is missing --dissociate option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-02T04:34:48Z","receivedAt":"2018-05-02T04:35:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n>> As far as I am aware this can be worked around with 'git repack -a'\n>> and manual removal of the objects/info/alternates file afterward.\n>> Though I don't know if this results in a less speedy clone than\n>> dissociate would.\n>\n> That is an interesting workaround!\n\nIt's not just \"workaround\", but actually is an implementation of\nthat exact option, no?\n"},{"id":"346424","messageId":"xmqqefiuwu4a.fsf@gitster-ct.c.googlers.com","threadId":"48381","inReplyTo":"20180502005528.19740-1-kcghost@gmail.com","subject":"Re: [PATCH 0/3] Add --progress and --dissociate to git submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-02T04:37:25Z","receivedAt":"2018-05-02T04:37:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Casey Fitzpatrick <kcghost@gmail.com> writes:\n\n> These patches add --progress and --dissociate options to git submodule.\n>\n> The --progress option existed beforehand, but only for the update command and\n> it was left undocumented.\n>\n> Both add and update submodule commands supported --reference, but not its pair\n> option --dissociate which allows for independent clones rather than depending\n> on the reference.\n>\n> This is a resubmission with comments from Stefan Beller and Eric Sunshine\n> addressed.\n\nReaders would really appreciate it if these are prepared with\nformat-patch with -v$N option.  Unless they read faster than you\npost patches, they will find a few messages identically titled, all\nunread in their mailbox, and it is not always easy to tell which\nones are the latest.\n\nThanks.\n"},{"id":"346428","messageId":"xmqqy3h2vbqj.fsf@gitster-ct.c.googlers.com","threadId":"48381","inReplyTo":"20180502005528.19740-2-kcghost@gmail.com","subject":"Re: [PATCH 1/3] submodule: clean up subsititions in script","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-02T05:59:48Z","receivedAt":"2018-05-02T05:59:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Casey Fitzpatrick <kcghost@gmail.com> writes:\n\n> 'recommend_shallow' and 'jobs' variables do not need quotes (they never contain\n> spaces) and do not require any additional prefix, therefore remove the\n> unnecessary subsitition.\n\nThe resulting patch is good, but \"they never contain spaces\" is not\na very good rationale.  The real reason is that (1) we use them only\nto hold a single token value (or leave them empty) in the current\ncode, and (2) if the feature they represent is enhanced in the\nfuture to make them multi-token options (e.g. we may allow $jobs to\ncontain, in addition to \"--jobs=2\", \"--jobs 2\" for whatever reason\nlater), it is likely that we would want these multi-tokens split at\n$IFS (e.g. \"--jobs\" and \"2\" get passed as separate option, not a\nsingle \"--jobs 2\" string).\n\n> 'progress' is a boolean value. Treat it like the other boolean values in the\n> script by using a substitution.\n\nThis is OK.\n\n>  \tgit submodule--helper update-clone ${GIT_QUIET:+--quiet} \\\n> -\t\t${progress:+\"$progress\"} \\\n> +\t\t${progress:+\"--progress\"} \\\n>  \t\t${wt_prefix:+--prefix \"$wt_prefix\"} \\\n>  \t\t${prefix:+--recursive-prefix \"$prefix\"} \\\n>  \t\t${update:+--update \"$update\"} \\\n>  \t\t${reference:+\"$reference\"} \\\n>  \t\t${depth:+--depth \"$depth\"} \\\n> -\t\t${recommend_shallow:+\"$recommend_shallow\"} \\\n> -\t\t${jobs:+$jobs} \\\n> +\t\t$recommend_shallow \\\n> +\t\t$jobs \\\n\n"},{"id":"346437","messageId":"CAEp-SHVj=EN7tD+s14DrCrXp=0fPFqWFbQNyPHFj_w2RUyBM2Q@mail.gmail.com","threadId":"48381","inReplyTo":"xmqqefiuwu4a.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 0/3] Add --progress and --dissociate to git submodule","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-02T08:54:17Z","receivedAt":"2018-05-02T08:54:21Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Thanks I was not aware of that option.\n\nOn Wed, May 2, 2018 at 12:37 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Casey Fitzpatrick <kcghost@gmail.com> writes:\n>\n>> These patches add --progress and --dissociate options to git submodule.\n>>\n>> The --progress option existed beforehand, but only for the update command and\n>> it was left undocumented.\n>>\n>> Both add and update submodule commands supported --reference, but not its pair\n>> option --dissociate which allows for independent clones rather than depending\n>> on the reference.\n>>\n>> This is a resubmission with comments from Stefan Beller and Eric Sunshine\n>> addressed.\n>\n> Readers would really appreciate it if these are prepared with\n> format-patch with -v$N option.  Unless they read faster than you\n> post patches, they will find a few messages identically titled, all\n> unread in their mailbox, and it is not always easy to tell which\n> ones are the latest.\n>\n> Thanks.\n"},{"id":"346506","messageId":"CAEp-SHXPKJNuc+dhkZu=Vr=ju8AMHq6Rd851vNOV3WUvOQnrLg@mail.gmail.com","threadId":"48381","inReplyTo":"xmqqy3h2vbqj.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH 1/3] submodule: clean up subsititions in script","fromName":"Casey Fitzpatrick","fromEmail":"kcghost@gmail.com","sentAt":"2018-05-03T10:46:39Z","receivedAt":"2018-05-03T10:46:45Z","isPatch":true,"sender":{"key":"kcghost@gmail.com","avatar":"https://avatars.githubusercontent.com/u/7506642?v=4"},"body":"Thanks I will amend and re-submit (this time with  -v$N, I apologize\nfor creating a confusing mess in everyone's email clients :))\n\nOn Wed, May 2, 2018 at 1:59 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Casey Fitzpatrick <kcghost@gmail.com> writes:\n>\n>> 'recommend_shallow' and 'jobs' variables do not need quotes (they never contain\n>> spaces) and do not require any additional prefix, therefore remove the\n>> unnecessary subsitition.\n>\n> The resulting patch is good, but \"they never contain spaces\" is not\n> a very good rationale.  The real reason is that (1) we use them only\n> to hold a single token value (or leave them empty) in the current\n> code, and (2) if the feature they represent is enhanced in the\n> future to make them multi-token options (e.g. we may allow $jobs to\n> contain, in addition to \"--jobs=2\", \"--jobs 2\" for whatever reason\n> later), it is likely that we would want these multi-tokens split at\n> $IFS (e.g. \"--jobs\" and \"2\" get passed as separate option, not a\n> single \"--jobs 2\" string).\n>\n>> 'progress' is a boolean value. Treat it like the other boolean values in the\n>> script by using a substitution.\n>\n> This is OK.\n>\n>>       git submodule--helper update-clone ${GIT_QUIET:+--quiet} \\\n>> -             ${progress:+\"$progress\"} \\\n>> +             ${progress:+\"--progress\"} \\\n>>               ${wt_prefix:+--prefix \"$wt_prefix\"} \\\n>>               ${prefix:+--recursive-prefix \"$prefix\"} \\\n>>               ${update:+--update \"$update\"} \\\n>>               ${reference:+\"$reference\"} \\\n>>               ${depth:+--depth \"$depth\"} \\\n>> -             ${recommend_shallow:+\"$recommend_shallow\"} \\\n>> -             ${jobs:+$jobs} \\\n>> +             $recommend_shallow \\\n>> +             $jobs \\\n>\n"}]}