{"thread":{"id":"38973","subject":"[PATCH] git-common-dir: make submodule related variables worktree specific","startedAt":"2015-04-01T21:23:27Z","lastAt":"2015-04-01T21:45:25Z","messageCount":3,"participants":["Max Kirillov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"258838","messageId":"1427923407-7939-1-git-send-email-max@max630.net","threadId":"38973","inReplyTo":null,"subject":"[PATCH] git-common-dir: make submodule related variables worktree specific","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2015-04-01T21:23:27Z","receivedAt":"2015-04-01T21:23:27Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"Then submodules in different worktrees will be fully independent.\nThey can, and should, be initialised and updated separately.\n\nUpdate t7410-submodule-checkout-to.sh to consider this.\n\nSigned-off-by: Max Kirillov <max@max630.net>\n---\nNow when there is implementation for worktree-specific module it is possible\nto make submodules in different worktrees fully independent.\n\nShould be applied over current next (111ea16e53) with merged $gmane/266520 and $gmane/266614\n t/t7410-submodule-checkout-to.sh | 38 ++++++++++++++++++++++++--------------\n templates/info--config.worktree  |  6 ++++++\n 2 files changed, 30 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t7410-submodule-checkout-to.sh b/t/t7410-submodule-checkout-to.sh\nindex 4a9dae8..9534a23 100755\n--- a/t/t7410-submodule-checkout-to.sh\n+++ b/t/t7410-submodule-checkout-to.sh\n@@ -8,20 +8,22 @@ base_path=$(pwd -P)\n \n test_expect_success 'setup: make origin' \\\n     'mkdir -p origin/sub && ( cd origin/sub && git init &&\n-\techo file1 >file1 &&\n-\tgit add file1 &&\n-\tgit commit -m file1 ) &&\n+\ttest_commit sub_init file ) &&\n+    mkdir -p origin/sub2 && ( cd origin/sub2 && git init &&\n+\ttest_commit sub2_init file ) &&\n     mkdir -p origin/main && ( cd origin/main && git init &&\n \tgit submodule add ../sub &&\n-\tgit commit -m \"add sub\" ) &&\n+\tgit submodule add ../sub2 &&\n+\tgit commit -m \"add submodules\" ) &&\n     ( cd origin/sub &&\n-\techo file1updated >file1 &&\n-\tgit add file1 &&\n-\tgit commit -m \"file1 updated\" ) &&\n+\ttest_commit sub_update file ) &&\n+    ( cd origin/sub2 &&\n+\ttest_commit sub2_update file ) &&\n     ( cd origin/main/sub && git pull ) &&\n+    ( cd origin/main/sub2 && git pull ) &&\n     ( cd origin/main &&\n-\tgit add sub &&\n-\tgit commit -m \"sub updated\" )'\n+\tgit add sub sub2 &&\n+\tgit commit -m \"submodules updated\" )'\n \n test_expect_success 'setup: clone' \\\n     'mkdir clone && ( cd clone &&\n@@ -35,17 +37,25 @@ test_expect_success 'checkout main' \\\n     (cd clone/main &&\n \tgit checkout --to \"$base_path/default_checkout/main\" \"$rev1_hash_main\")'\n \n-test_expect_failure 'can see submodule diffs just after checkout' \\\n-    '(cd default_checkout/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+test_expect_success 'cannot see submodule diffs just after checking out main' \\\n+    '(cd default_checkout/main &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub .*(not checked out)\" &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub2 .*(not checked out)\")'\n \n test_expect_success 'checkout main and initialize independed clones' \\\n     'mkdir fully_cloned_submodule &&\n     (cd clone/main &&\n \tgit checkout --to \"$base_path/fully_cloned_submodule/main\" \"$rev1_hash_main\") &&\n-    (cd fully_cloned_submodule/main && git submodule update)'\n+    (cd fully_cloned_submodule/main &&\n+\tgit submodule init sub &&\n+\tgit submodule update)'\n \n test_expect_success 'can see submodule diffs after independed cloning' \\\n-    '(cd fully_cloned_submodule/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+    '(cd fully_cloned_submodule/main && git diff --submodule master\"^!\" | grep \"sub_update\")'\n+\n+test_expect_success 'sub2 remains uninitialized' '\n+    (cd fully_cloned_submodule/main &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub2 .*(not checked out)\")'\n \n test_expect_success 'checkout sub manually' \\\n     'mkdir linked_submodule &&\n@@ -55,7 +65,7 @@ test_expect_success 'checkout sub manually' \\\n \tgit checkout --to \"$base_path/linked_submodule/main/sub\" \"$rev1_hash_sub\")'\n \n test_expect_success 'can see submodule diffs after manual checkout of linked submodule' \\\n-    '(cd linked_submodule/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+    '(cd linked_submodule/main && git diff --submodule master\"^!\" | grep \"sub_update\")'\n \n # test_expect_success 'archive' 'tar czf ../t7410.tar.gz .'\n \ndiff --git a/templates/info--config.worktree b/templates/info--config.worktree\nindex f358230..c78916a 100644\n--- a/templates/info--config.worktree\n+++ b/templates/info--config.worktree\n@@ -1,2 +1,8 @@\n core.worktree\n core.bare\n+submodule.*.path\n+submodule.*.url\n+submodule.*.update\n+submodule.*.branch\n+submodule.*.fetchRecurseSubmodules\n+submodule.*.ignore\n-- \n2.3.4.2801.g3d0809b\n"},{"id":"258839","messageId":"1427923712-8177-1-git-send-email-max@max630.net","threadId":"38973","inReplyTo":"1427923407-7939-1-git-send-email-max@max630.net","subject":"[PATCH v2] git-common-dir: make submodule related variables worktree specific","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2015-04-01T21:28:32Z","receivedAt":"2015-04-01T21:28:32Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"Then submodules in different worktrees will be fully independent.\nThey can, and should, be initialised and updated separately.\n\nUpdate t7410-submodule-checkout-to.sh to consider this.\n\nSigned-off-by: Max Kirillov <max@max630.net>\n---\nSome local slipped into patch which can break applying. Now hopely correct\n t/t7410-submodule-checkout-to.sh | 38 ++++++++++++++++++++++++--------------\n templates/info--config.worktree  |  6 ++++++\n 2 files changed, 30 insertions(+), 14 deletions(-)\n\ndiff --git a/t/t7410-submodule-checkout-to.sh b/t/t7410-submodule-checkout-to.sh\nindex b43391a..ce41e6b 100755\n--- a/t/t7410-submodule-checkout-to.sh\n+++ b/t/t7410-submodule-checkout-to.sh\n@@ -8,20 +8,22 @@ base_path=$(pwd -P)\n \n test_expect_success 'setup: make origin' \\\n     'mkdir -p origin/sub && ( cd origin/sub && git init &&\n-\techo file1 >file1 &&\n-\tgit add file1 &&\n-\tgit commit -m file1 ) &&\n+\ttest_commit sub_init file ) &&\n+    mkdir -p origin/sub2 && ( cd origin/sub2 && git init &&\n+\ttest_commit sub2_init file ) &&\n     mkdir -p origin/main && ( cd origin/main && git init &&\n \tgit submodule add ../sub &&\n-\tgit commit -m \"add sub\" ) &&\n+\tgit submodule add ../sub2 &&\n+\tgit commit -m \"add submodules\" ) &&\n     ( cd origin/sub &&\n-\techo file1updated >file1 &&\n-\tgit add file1 &&\n-\tgit commit -m \"file1 updated\" ) &&\n+\ttest_commit sub_update file ) &&\n+    ( cd origin/sub2 &&\n+\ttest_commit sub2_update file ) &&\n     ( cd origin/main/sub && git pull ) &&\n+    ( cd origin/main/sub2 && git pull ) &&\n     ( cd origin/main &&\n-\tgit add sub &&\n-\tgit commit -m \"sub updated\" )'\n+\tgit add sub sub2 &&\n+\tgit commit -m \"submodules updated\" )'\n \n test_expect_success 'setup: clone' \\\n     'mkdir clone && ( cd clone &&\n@@ -35,17 +37,25 @@ test_expect_success 'checkout main' \\\n     (cd clone/main &&\n \tgit checkout --to \"$base_path/default_checkout/main\" \"$rev1_hash_main\")'\n \n-test_expect_failure 'can see submodule diffs just after checkout' \\\n-    '(cd default_checkout/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+test_expect_success 'cannot see submodule diffs just after checking out main' \\\n+    '(cd default_checkout/main &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub .*(not checked out)\" &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub2 .*(not checked out)\")'\n \n test_expect_success 'checkout main and initialize independed clones' \\\n     'mkdir fully_cloned_submodule &&\n     (cd clone/main &&\n \tgit checkout --to \"$base_path/fully_cloned_submodule/main\" \"$rev1_hash_main\") &&\n-    (cd fully_cloned_submodule/main && git submodule update)'\n+    (cd fully_cloned_submodule/main &&\n+\tgit submodule init sub &&\n+\tgit submodule update)'\n \n test_expect_success 'can see submodule diffs after independed cloning' \\\n-    '(cd fully_cloned_submodule/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+    '(cd fully_cloned_submodule/main && git diff --submodule master\"^!\" | grep \"sub_update\")'\n+\n+test_expect_success 'sub2 remains uninitialized' '\n+    (cd fully_cloned_submodule/main &&\n+\tgit diff --submodule master\"^!\" | grep \"Submodule sub2 .*(not checked out)\")'\n \n test_expect_success 'checkout sub manually' \\\n     'mkdir linked_submodule &&\n@@ -55,6 +65,6 @@ test_expect_success 'checkout sub manually' \\\n \tgit checkout --to \"$base_path/linked_submodule/main/sub\" \"$rev1_hash_sub\")'\n \n test_expect_success 'can see submodule diffs after manual checkout of linked submodule' \\\n-    '(cd linked_submodule/main && git diff --submodule master\"^!\" | grep \"file1 updated\")'\n+    '(cd linked_submodule/main && git diff --submodule master\"^!\" | grep \"sub_update\")'\n \n test_done\ndiff --git a/templates/info--config.worktree b/templates/info--config.worktree\nindex f358230..c78916a 100644\n--- a/templates/info--config.worktree\n+++ b/templates/info--config.worktree\n@@ -1,2 +1,8 @@\n core.worktree\n core.bare\n+submodule.*.path\n+submodule.*.url\n+submodule.*.update\n+submodule.*.branch\n+submodule.*.fetchRecurseSubmodules\n+submodule.*.ignore\n-- \n2.3.4.2801.g3d0809b\n"},{"id":"258840","messageId":"20150401214525.GC8771@wheezy.local","threadId":"38973","inReplyTo":"1427923407-7939-1-git-send-email-max@max630.net","subject":"Re: [PATCH] git-common-dir: make submodule related variables worktree specific","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2015-04-01T21:45:25Z","receivedAt":"2015-04-01T21:45:25Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"On Thu, Apr 02, 2015 at 12:23:27AM +0300, Max Kirillov wrote:\n> Then submodules in different worktrees will be fully independent.\n> They can, and should, be initialised and updated separately.\n> \n> Update t7410-submodule-checkout-to.sh to consider this.\n> \n> Signed-off-by: Max Kirillov <max@max630.net>\n> ---\n> Now when there is implementation for worktree-specific module it is possible\n> to make submodules in different worktrees fully independent.\n> \n> Should be applied over current next (111ea16e53) with merged $gmane/266520 and $gmane/266614\n\nI mean $gmane/266520 and $gmane/265762\n"}]}