{"thread":{"id":"35507","subject":"mv/rm submodules","startedAt":"2013-12-09T10:59:11Z","lastAt":"2014-01-07T21:32:37Z","messageCount":8,"participants":["George Papanikolaou","Jens Lehmann","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"231785","messageId":"CAByyCQCakKyUqJQDdFrTMf2CUJihRhqSUVCwT21VDN1EOerVWw@mail.gmail.com","threadId":"35507","inReplyTo":null,"subject":"mv/rm submodules","fromName":"George Papanikolaou","fromEmail":"g3orge.app@gmail.com","sentAt":"2013-12-09T10:59:11Z","receivedAt":"2013-12-09T10:59:11Z","isPatch":false,"sender":{"key":"g3orge.app@gmail.com","avatar":"https://gravatar.com/avatar/57d9756bb8e51dd138b79f2276e0bb0be2bfdc9aa60f08704de80e96d3a1c0f8?d=mp&s=160"},"body":"Hi list,\n\nI was just playing with the new features of 'git mv' in 1.8.5 and\nrealized that both rm\nand mv don't change the .git/config file. Is that on purpuse?\nAlso after mv you need to run 'submodule update' and I think this should be\ndocumented somewhere.\n\nThanks..\n\n-- \nGeorge 'papanikge' Papanikolaou\ng3orge.app@gmail.com\n"},{"id":"231793","messageId":"52A602A2.6060909@web.de","threadId":"35507","inReplyTo":"CAByyCQCakKyUqJQDdFrTMf2CUJihRhqSUVCwT21VDN1EOerVWw@mail.gmail.com","subject":"Re: mv/rm submodules","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2013-12-09T17:49:22Z","receivedAt":"2013-12-09T17:49:22Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 09.12.2013 11:59, schrieb George Papanikolaou:\n> I was just playing with the new features of 'git mv' in 1.8.5 and\n> realized that both rm\n> and mv don't change the .git/config file. Is that on purpuse?\n\nYes. Only the \"path\" entry in .gitmodules needs to be updated\nwhen a submodule is moved. Its name stays the same and thus the\n.git/config entry automatically applies to the new location.\n\n> Also after mv you need to run 'submodule update' and I think this should be\n> documented somewhere.\n\nYou're right, this should be mentioned in the mv man page. I'll\nprepare a patch for that.\n\nThanks for your feedback.\n"},{"id":"232752","messageId":"52CB023C.2050001@web.de","threadId":"35507","inReplyTo":"52A602A2.6060909@web.de","subject":"[PATCH] mv: better document side effects when moving a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-01-06T19:21:32Z","receivedAt":"2014-01-06T19:21:32Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The \"Submodules\" section of the \"git mv\" documentation mentions what will\nhappen when a submodule with a gitfile gets moved with newer git. But it\ndoesn't talk about what happens when the user changes between commits\nbefore and after the move, which does not update the work tree like using\nthe mv command did the first time.\n\nExplain what happens and what the user has to do manually to fix that.\nAlso document this in a new test.\n\nReported-by: George Papanikolaou <g3orge.app@gmail.com>\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n\nAm 09.12.2013 18:49, schrieb Jens Lehmann:\n> Am 09.12.2013 11:59, schrieb George Papanikolaou:\n>> Also after mv you need to run 'submodule update' and I think this should be\n>> documented somewhere.\n> \n> You're right, this should be mentioned in the mv man page. I'll\n> prepare a patch for that.\n\nDoes this new paragraph make it clearer?\n\n\n Documentation/git-mv.txt | 10 ++++++++++\n t/t7001-mv.sh            | 21 +++++++++++++++++++++\n 2 files changed, 31 insertions(+)\n\ndiff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt\nindex b1f7988..c9e8568 100644\n--- a/Documentation/git-mv.txt\n+++ b/Documentation/git-mv.txt\n@@ -52,6 +52,16 @@ core.worktree setting to make the submodule work in the new location.\n It also will attempt to update the submodule.<name>.path setting in\n the linkgit:gitmodules[5] file and stage that file (unless -n is used).\n\n+Please note that each time a superproject update moves a populated\n+submodule (e.g. when switching between commits before and after the\n+move) a stale submodule checkout will remain in the old location\n+and an empty directory will appear in the new location. To populate\n+the submodule again in the new location the user will have to run\n+\"git submodule update\" afterwards. Removing the old directory is\n+only safe when it uses a gitfile, as otherwise the history of the\n+submodule will be deleted too. Both steps will be obsolete when\n+recursive submodule update has been implemented.\n+\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex 3bfdfed..e3c8c2c 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '\n \tgit diff-files --quiet -- sub .gitmodules\n '\n\n+test_expect_success 'checking out a commit before submodule moved needs manual updates' '\n+\tgit mv sub sub2 &&\n+\tgit commit -m \"moved sub to sub2\" &&\n+\tgit checkout -q HEAD^ 2>actual &&\n+\techo \"warning: unable to rmdir sub2: Directory not empty\" >expected &&\n+\ttest_i18ncmp expected actual &&\n+\tgit status -s sub2 >actual &&\n+\techo \"?? sub2/\" >expected &&\n+\ttest_cmp expected actual &&\n+\t! test -f sub/.git &&\n+\ttest -f sub2/.git &&\n+\tgit submodule update &&\n+\ttest -f sub/.git &&\n+\trm -rf sub2 &&\n+\tgit diff-index --exit-code HEAD &&\n+\tgit update-index --refresh &&\n+\tgit diff-files --quiet -- sub .gitmodules &&\n+\tgit status -s sub2 >actual &&\n+\t! test -s actual\n+'\n+\n test_done\n-- \n1.8.5.2.230.g9325930\n"},{"id":"232786","messageId":"xmqq8uushgz3.fsf@gitster.dls.corp.google.com","threadId":"35507","inReplyTo":"52CB023C.2050001@web.de","subject":"Re: [PATCH] mv: better document side effects when moving a submodule","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-06T22:40:16Z","receivedAt":"2014-01-06T22:40:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> The \"Submodules\" section of the \"git mv\" documentation mentions what will\n> happen when a submodule with a gitfile gets moved with newer git. But it\n> doesn't talk about what happens when the user changes between commits\n> before and after the move, which does not update the work tree like using\n> the mv command did the first time.\n>\n> Explain what happens and what the user has to do manually to fix that.\n> Also document this in a new test.\n>\n> Reported-by: George Papanikolaou <g3orge.app@gmail.com>\n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n> ---\n>\n> Am 09.12.2013 18:49, schrieb Jens Lehmann:\n>> Am 09.12.2013 11:59, schrieb George Papanikolaou:\n>>> Also after mv you need to run 'submodule update' and I think this should be\n>>> documented somewhere.\n>> \n>> You're right, this should be mentioned in the mv man page. I'll\n>> prepare a patch for that.\n>\n> Does this new paragraph make it clearer?\n\nDon't we have bugs section that we can use to list the known\nlimitations like this?\n\n>  Documentation/git-mv.txt | 10 ++++++++++\n>  t/t7001-mv.sh            | 21 +++++++++++++++++++++\n\nIt also may make sense to express the test as \"this is what we would\nlike to see happen eventually\" in the form of test_expect_failure;\nit is not a big deal though.\n\n>  2 files changed, 31 insertions(+)\n>\n> diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt\n> index b1f7988..c9e8568 100644\n> --- a/Documentation/git-mv.txt\n> +++ b/Documentation/git-mv.txt\n> @@ -52,6 +52,16 @@ core.worktree setting to make the submodule work in the new location.\n>  It also will attempt to update the submodule.<name>.path setting in\n>  the linkgit:gitmodules[5] file and stage that file (unless -n is used).\n>\n> +Please note that each time a superproject update moves a populated\n> +submodule (e.g. when switching between commits before and after the\n> +move) a stale submodule checkout will remain in the old location\n> +and an empty directory will appear in the new location. To populate\n> +the submodule again in the new location the user will have to run\n> +\"git submodule update\" afterwards. Removing the old directory is\n> +only safe when it uses a gitfile, as otherwise the history of the\n> +submodule will be deleted too. Both steps will be obsolete when\n> +recursive submodule update has been implemented.\n> +\n>  GIT\n>  ---\n>  Part of the linkgit:git[1] suite\n> diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\n> index 3bfdfed..e3c8c2c 100755\n> --- a/t/t7001-mv.sh\n> +++ b/t/t7001-mv.sh\n> @@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '\n>  \tgit diff-files --quiet -- sub .gitmodules\n>  '\n>\n> +test_expect_success 'checking out a commit before submodule moved needs manual updates' '\n> +\tgit mv sub sub2 &&\n> +\tgit commit -m \"moved sub to sub2\" &&\n> +\tgit checkout -q HEAD^ 2>actual &&\n> +\techo \"warning: unable to rmdir sub2: Directory not empty\" >expected &&\n> +\ttest_i18ncmp expected actual &&\n> +\tgit status -s sub2 >actual &&\n> +\techo \"?? sub2/\" >expected &&\n> +\ttest_cmp expected actual &&\n> +\t! test -f sub/.git &&\n> +\ttest -f sub2/.git &&\n> +\tgit submodule update &&\n> +\ttest -f sub/.git &&\n> +\trm -rf sub2 &&\n> +\tgit diff-index --exit-code HEAD &&\n> +\tgit update-index --refresh &&\n> +\tgit diff-files --quiet -- sub .gitmodules &&\n> +\tgit status -s sub2 >actual &&\n> +\t! test -s actual\n> +'\n> +\n>  test_done\n"},{"id":"232822","messageId":"52CC4021.60209@web.de","threadId":"35507","inReplyTo":"xmqq8uushgz3.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] mv: better document side effects when moving a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-01-07T17:57:53Z","receivedAt":"2014-01-07T17:57:53Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 06.01.2014 23:40, schrieb Junio C Hamano:\n> Jens Lehmann <Jens.Lehmann@web.de> writes:\n>> Does this new paragraph make it clearer?\n> \n> Don't we have bugs section that we can use to list the known\n> limitations like this?\n\nRight, will change accordingly in v2.\n\n>>  Documentation/git-mv.txt | 10 ++++++++++\n>>  t/t7001-mv.sh            | 21 +++++++++++++++++++++\n> \n> It also may make sense to express the test as \"this is what we would\n> like to see happen eventually\" in the form of test_expect_failure;\n> it is not a big deal though.\n\nWe'll get the \"what we would like to see happen eventually\" test for\nfree from the recursive submodule update framework I'm currently\nimplementing, so I propose we don't implement this exepected failure\nin this patch.\n"},{"id":"232859","messageId":"52CC71E0.7010603@web.de","threadId":"35507","inReplyTo":"52CC4021.60209@web.de","subject":"[PATCH v2 0/2] better document side effects when [re]moving a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-01-07T21:30:08Z","receivedAt":"2014-01-07T21:30:08Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 07.01.2014 18:57, schrieb Jens Lehmann:\n> Am 06.01.2014 23:40, schrieb Junio C Hamano:\n>> Jens Lehmann <Jens.Lehmann@web.de> writes:\n>>> Does this new paragraph make it clearer?\n>>\n>> Don't we have bugs section that we can use to list the known\n>> limitations like this?\n> \n> Right, will change accordingly in v2.\n\nChanges from v1:\n\n- Document side effects under the BUGS section\n\n- Add similar documentation for \"git rm\"\n\n\nJens Lehmann (2):\n  mv: better document side effects when moving a submodule\n  rm: better document side effects when removing a submodule\n\n Documentation/git-mv.txt | 12 ++++++++++++\n Documentation/git-rm.txt |  9 +++++++++\n t/t3600-rm.sh            | 16 ++++++++++++++++\n t/t7001-mv.sh            | 21 +++++++++++++++++++++\n 4 files changed, 58 insertions(+)\n\n-- \n1.8.5.2.231.gfc86eb1\n"},{"id":"232861","messageId":"52CC7234.7090700@web.de","threadId":"35507","inReplyTo":"52CC71E0.7010603@web.de","subject":"[PATCH v2 1/2] mv: better document side effects when moving a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-01-07T21:31:32Z","receivedAt":"2014-01-07T21:31:32Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The \"Submodules\" section of the \"git mv\" documentation mentions what will\nhappen when a submodule with a gitfile gets moved with newer git. But it\ndoesn't talk about what happens when the user changes between commits\nbefore and after the move, which does not update the work tree like using\nthe mv command did the first time.\n\nExplain what happens and what the user has to do manually to fix that in\nthe new BUGS section. Also document this behavior in a new test.\n\nReported-by: George Papanikolaou <g3orge.app@gmail.com>\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n Documentation/git-mv.txt | 12 ++++++++++++\n t/t7001-mv.sh            | 21 +++++++++++++++++++++\n 2 files changed, 33 insertions(+)\n\ndiff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt\nindex b1f7988..e453132 100644\n--- a/Documentation/git-mv.txt\n+++ b/Documentation/git-mv.txt\n@@ -52,6 +52,18 @@ core.worktree setting to make the submodule work in the new location.\n It also will attempt to update the submodule.<name>.path setting in\n the linkgit:gitmodules[5] file and stage that file (unless -n is used).\n\n+BUGS\n+----\n+Each time a superproject update moves a populated submodule (e.g. when\n+switching between commits before and after the move) a stale submodule\n+checkout will remain in the old location and an empty directory will\n+appear in the new location. To populate the submodule again in the new\n+location the user will have to run \"git submodule update\"\n+afterwards. Removing the old directory is only safe when it uses a\n+gitfile, as otherwise the history of the submodule will be deleted\n+too. Both steps will be obsolete when recursive submodule update has\n+been implemented.\n+\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/t/t7001-mv.sh b/t/t7001-mv.sh\nindex 3bfdfed..e3c8c2c 100755\n--- a/t/t7001-mv.sh\n+++ b/t/t7001-mv.sh\n@@ -442,4 +442,25 @@ test_expect_success 'mv --dry-run does not touch the submodule or .gitmodules' '\n \tgit diff-files --quiet -- sub .gitmodules\n '\n\n+test_expect_success 'checking out a commit before submodule moved needs manual updates' '\n+\tgit mv sub sub2 &&\n+\tgit commit -m \"moved sub to sub2\" &&\n+\tgit checkout -q HEAD^ 2>actual &&\n+\techo \"warning: unable to rmdir sub2: Directory not empty\" >expected &&\n+\ttest_i18ncmp expected actual &&\n+\tgit status -s sub2 >actual &&\n+\techo \"?? sub2/\" >expected &&\n+\ttest_cmp expected actual &&\n+\t! test -f sub/.git &&\n+\ttest -f sub2/.git &&\n+\tgit submodule update &&\n+\ttest -f sub/.git &&\n+\trm -rf sub2 &&\n+\tgit diff-index --exit-code HEAD &&\n+\tgit update-index --refresh &&\n+\tgit diff-files --quiet -- sub .gitmodules &&\n+\tgit status -s sub2 >actual &&\n+\t! test -s actual\n+'\n+\n test_done\n-- \n1.8.5.2.231.gfc86eb1\n"},{"id":"232862","messageId":"52CC7275.3040907@web.de","threadId":"35507","inReplyTo":"52CC71E0.7010603@web.de","subject":"[PATCH v2 2/2] rm: better document side effects when removing a submodule","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2014-01-07T21:32:37Z","receivedAt":"2014-01-07T21:32:37Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"The \"Submodules\" section of the \"git rm\" documentation mentions what will\nhappen when a submodule with a gitfile gets removed with newer git. But it\ndoesn't talk about what happens when the user changes between commits\nbefore and after the removal, which does not remove the submodule from the\nwork tree like using the rm command did the first time.\n\nExplain what happens and what the user has to do manually to fix that in\nthe new BUGS section. Also document this behavior in a new test.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n Documentation/git-rm.txt |  9 +++++++++\n t/t3600-rm.sh            | 16 ++++++++++++++++\n 2 files changed, 25 insertions(+)\n\ndiff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt\nindex 9d731b4..f1efc11 100644\n--- a/Documentation/git-rm.txt\n+++ b/Documentation/git-rm.txt\n@@ -170,6 +170,15 @@ of files and subdirectories under the `Documentation/` directory.\n \t(i.e. you are listing the files explicitly), it\n \tdoes not remove `subdir/git-foo.sh`.\n\n+BUGS\n+----\n+Each time a superproject update removes a populated submodule\n+(e.g. when switching between commits before and after the removal) a\n+stale submodule checkout will remain in the old location. Removing the\n+old directory is only safe when it uses a gitfile, as otherwise the\n+history of the submodule will be deleted too. This step will be\n+obsolete when recursive submodule update has been implemented.\n+\n SEE ALSO\n --------\n linkgit:git-add[1]\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex 540c49b..3d30581 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -705,6 +705,22 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc\n \trm -rf submod\n '\n\n+test_expect_success 'checking out a commit after submodule removal needs manual updates' '\n+\tgit commit -m \"submodule removal\" submod &&\n+\tgit checkout HEAD^ &&\n+\tgit submodule update &&\n+\tgit checkout -q HEAD^ 2>actual &&\n+\tgit checkout -q master 2>actual &&\n+\techo \"warning: unable to rmdir submod: Directory not empty\" >expected &&\n+\ttest_i18ncmp expected actual &&\n+\tgit status -s submod >actual &&\n+\techo \"?? submod/\" >expected &&\n+\ttest_cmp expected actual &&\n+\trm -rf submod &&\n+\tgit status -s -uno --ignore-submodules=none > actual &&\n+\t! test -s actual\n+'\n+\n test_expect_success 'rm of d/f when d has become a non-directory' '\n \trm -rf d &&\n \tmkdir d &&\n-- \n1.8.5.2.231.gfc86eb1\n"}]}