git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git-common-dir: make submodule related variables worktree specific
@ 2015-04-01 21:23 Max Kirillov
  2015-04-01 21:28 ` [PATCH v2] " Max Kirillov
  2015-04-01 21:45 ` [PATCH] " Max Kirillov
  0 siblings, 2 replies; 3+ messages in thread
From: Max Kirillov @ 2015-04-01 21:23 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy, Jens Lehmann
  Cc: Junio C Hamano, git, Max Kirillov

Then submodules in different worktrees will be fully independent.
They can, and should, be initialised and updated separately.

Update t7410-submodule-checkout-to.sh to consider this.

Signed-off-by: Max Kirillov <max@max630.net>
---
Now when there is implementation for worktree-specific module it is possible
to make submodules in different worktrees fully independent.

Should be applied over current next (111ea16e53) with merged $gmane/266520 and $gmane/266614
 t/t7410-submodule-checkout-to.sh | 38 ++++++++++++++++++++++++--------------
 templates/info--config.worktree  |  6 ++++++
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/t/t7410-submodule-checkout-to.sh b/t/t7410-submodule-checkout-to.sh
index 4a9dae8..9534a23 100755
--- a/t/t7410-submodule-checkout-to.sh
+++ b/t/t7410-submodule-checkout-to.sh
@@ -8,20 +8,22 @@ base_path=$(pwd -P)
 
 test_expect_success 'setup: make origin' \
     'mkdir -p origin/sub && ( cd origin/sub && git init &&
-	echo file1 >file1 &&
-	git add file1 &&
-	git commit -m file1 ) &&
+	test_commit sub_init file ) &&
+    mkdir -p origin/sub2 && ( cd origin/sub2 && git init &&
+	test_commit sub2_init file ) &&
     mkdir -p origin/main && ( cd origin/main && git init &&
 	git submodule add ../sub &&
-	git commit -m "add sub" ) &&
+	git submodule add ../sub2 &&
+	git commit -m "add submodules" ) &&
     ( cd origin/sub &&
-	echo file1updated >file1 &&
-	git add file1 &&
-	git commit -m "file1 updated" ) &&
+	test_commit sub_update file ) &&
+    ( cd origin/sub2 &&
+	test_commit sub2_update file ) &&
     ( cd origin/main/sub && git pull ) &&
+    ( cd origin/main/sub2 && git pull ) &&
     ( cd origin/main &&
-	git add sub &&
-	git commit -m "sub updated" )'
+	git add sub sub2 &&
+	git commit -m "submodules updated" )'
 
 test_expect_success 'setup: clone' \
     'mkdir clone && ( cd clone &&
@@ -35,17 +37,25 @@ test_expect_success 'checkout main' \
     (cd clone/main &&
 	git checkout --to "$base_path/default_checkout/main" "$rev1_hash_main")'
 
-test_expect_failure 'can see submodule diffs just after checkout' \
-    '(cd default_checkout/main && git diff --submodule master"^!" | grep "file1 updated")'
+test_expect_success 'cannot see submodule diffs just after checking out main' \
+    '(cd default_checkout/main &&
+	git diff --submodule master"^!" | grep "Submodule sub .*(not checked out)" &&
+	git diff --submodule master"^!" | grep "Submodule sub2 .*(not checked out)")'
 
 test_expect_success 'checkout main and initialize independed clones' \
     'mkdir fully_cloned_submodule &&
     (cd clone/main &&
 	git checkout --to "$base_path/fully_cloned_submodule/main" "$rev1_hash_main") &&
-    (cd fully_cloned_submodule/main && git submodule update)'
+    (cd fully_cloned_submodule/main &&
+	git submodule init sub &&
+	git submodule update)'
 
 test_expect_success 'can see submodule diffs after independed cloning' \
-    '(cd fully_cloned_submodule/main && git diff --submodule master"^!" | grep "file1 updated")'
+    '(cd fully_cloned_submodule/main && git diff --submodule master"^!" | grep "sub_update")'
+
+test_expect_success 'sub2 remains uninitialized' '
+    (cd fully_cloned_submodule/main &&
+	git diff --submodule master"^!" | grep "Submodule sub2 .*(not checked out)")'
 
 test_expect_success 'checkout sub manually' \
     'mkdir linked_submodule &&
@@ -55,7 +65,7 @@ test_expect_success 'checkout sub manually' \
 	git checkout --to "$base_path/linked_submodule/main/sub" "$rev1_hash_sub")'
 
 test_expect_success 'can see submodule diffs after manual checkout of linked submodule' \
-    '(cd linked_submodule/main && git diff --submodule master"^!" | grep "file1 updated")'
+    '(cd linked_submodule/main && git diff --submodule master"^!" | grep "sub_update")'
 
 # test_expect_success 'archive' 'tar czf ../t7410.tar.gz .'
 
diff --git a/templates/info--config.worktree b/templates/info--config.worktree
index f358230..c78916a 100644
--- a/templates/info--config.worktree
+++ b/templates/info--config.worktree
@@ -1,2 +1,8 @@
 core.worktree
 core.bare
+submodule.*.path
+submodule.*.url
+submodule.*.update
+submodule.*.branch
+submodule.*.fetchRecurseSubmodules
+submodule.*.ignore
-- 
2.3.4.2801.g3d0809b

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] git-common-dir: make submodule related variables worktree specific
  2015-04-01 21:23 [PATCH] git-common-dir: make submodule related variables worktree specific Max Kirillov
@ 2015-04-01 21:28 ` Max Kirillov
  2015-04-01 21:45 ` [PATCH] " Max Kirillov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Kirillov @ 2015-04-01 21:28 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy, Jens Lehmann
  Cc: Junio C Hamano, git, Max Kirillov

Then submodules in different worktrees will be fully independent.
They can, and should, be initialised and updated separately.

Update t7410-submodule-checkout-to.sh to consider this.

Signed-off-by: Max Kirillov <max@max630.net>
---
Some local slipped into patch which can break applying. Now hopely correct
 t/t7410-submodule-checkout-to.sh | 38 ++++++++++++++++++++++++--------------
 templates/info--config.worktree  |  6 ++++++
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/t/t7410-submodule-checkout-to.sh b/t/t7410-submodule-checkout-to.sh
index b43391a..ce41e6b 100755
--- a/t/t7410-submodule-checkout-to.sh
+++ b/t/t7410-submodule-checkout-to.sh
@@ -8,20 +8,22 @@ base_path=$(pwd -P)
 
 test_expect_success 'setup: make origin' \
     'mkdir -p origin/sub && ( cd origin/sub && git init &&
-	echo file1 >file1 &&
-	git add file1 &&
-	git commit -m file1 ) &&
+	test_commit sub_init file ) &&
+    mkdir -p origin/sub2 && ( cd origin/sub2 && git init &&
+	test_commit sub2_init file ) &&
     mkdir -p origin/main && ( cd origin/main && git init &&
 	git submodule add ../sub &&
-	git commit -m "add sub" ) &&
+	git submodule add ../sub2 &&
+	git commit -m "add submodules" ) &&
     ( cd origin/sub &&
-	echo file1updated >file1 &&
-	git add file1 &&
-	git commit -m "file1 updated" ) &&
+	test_commit sub_update file ) &&
+    ( cd origin/sub2 &&
+	test_commit sub2_update file ) &&
     ( cd origin/main/sub && git pull ) &&
+    ( cd origin/main/sub2 && git pull ) &&
     ( cd origin/main &&
-	git add sub &&
-	git commit -m "sub updated" )'
+	git add sub sub2 &&
+	git commit -m "submodules updated" )'
 
 test_expect_success 'setup: clone' \
     'mkdir clone && ( cd clone &&
@@ -35,17 +37,25 @@ test_expect_success 'checkout main' \
     (cd clone/main &&
 	git checkout --to "$base_path/default_checkout/main" "$rev1_hash_main")'
 
-test_expect_failure 'can see submodule diffs just after checkout' \
-    '(cd default_checkout/main && git diff --submodule master"^!" | grep "file1 updated")'
+test_expect_success 'cannot see submodule diffs just after checking out main' \
+    '(cd default_checkout/main &&
+	git diff --submodule master"^!" | grep "Submodule sub .*(not checked out)" &&
+	git diff --submodule master"^!" | grep "Submodule sub2 .*(not checked out)")'
 
 test_expect_success 'checkout main and initialize independed clones' \
     'mkdir fully_cloned_submodule &&
     (cd clone/main &&
 	git checkout --to "$base_path/fully_cloned_submodule/main" "$rev1_hash_main") &&
-    (cd fully_cloned_submodule/main && git submodule update)'
+    (cd fully_cloned_submodule/main &&
+	git submodule init sub &&
+	git submodule update)'
 
 test_expect_success 'can see submodule diffs after independed cloning' \
-    '(cd fully_cloned_submodule/main && git diff --submodule master"^!" | grep "file1 updated")'
+    '(cd fully_cloned_submodule/main && git diff --submodule master"^!" | grep "sub_update")'
+
+test_expect_success 'sub2 remains uninitialized' '
+    (cd fully_cloned_submodule/main &&
+	git diff --submodule master"^!" | grep "Submodule sub2 .*(not checked out)")'
 
 test_expect_success 'checkout sub manually' \
     'mkdir linked_submodule &&
@@ -55,6 +65,6 @@ test_expect_success 'checkout sub manually' \
 	git checkout --to "$base_path/linked_submodule/main/sub" "$rev1_hash_sub")'
 
 test_expect_success 'can see submodule diffs after manual checkout of linked submodule' \
-    '(cd linked_submodule/main && git diff --submodule master"^!" | grep "file1 updated")'
+    '(cd linked_submodule/main && git diff --submodule master"^!" | grep "sub_update")'
 
 test_done
diff --git a/templates/info--config.worktree b/templates/info--config.worktree
index f358230..c78916a 100644
--- a/templates/info--config.worktree
+++ b/templates/info--config.worktree
@@ -1,2 +1,8 @@
 core.worktree
 core.bare
+submodule.*.path
+submodule.*.url
+submodule.*.update
+submodule.*.branch
+submodule.*.fetchRecurseSubmodules
+submodule.*.ignore
-- 
2.3.4.2801.g3d0809b

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-common-dir: make submodule related variables worktree specific
  2015-04-01 21:23 [PATCH] git-common-dir: make submodule related variables worktree specific Max Kirillov
  2015-04-01 21:28 ` [PATCH v2] " Max Kirillov
@ 2015-04-01 21:45 ` Max Kirillov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Kirillov @ 2015-04-01 21:45 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy, Jens Lehmann; +Cc: Junio C Hamano, git

On Thu, Apr 02, 2015 at 12:23:27AM +0300, Max Kirillov wrote:
> Then submodules in different worktrees will be fully independent.
> They can, and should, be initialised and updated separately.
> 
> Update t7410-submodule-checkout-to.sh to consider this.
> 
> Signed-off-by: Max Kirillov <max@max630.net>
> ---
> Now when there is implementation for worktree-specific module it is possible
> to make submodules in different worktrees fully independent.
> 
> Should be applied over current next (111ea16e53) with merged $gmane/266520 and $gmane/266614

I mean $gmane/266520 and $gmane/265762

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-01 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 21:23 [PATCH] git-common-dir: make submodule related variables worktree specific Max Kirillov
2015-04-01 21:28 ` [PATCH v2] " Max Kirillov
2015-04-01 21:45 ` [PATCH] " Max Kirillov

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).