From: Max Kirillov <max@max630.net>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Jens Lehmann" <Jens.Lehmann@web.de>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Max Kirillov <max@max630.net>
Subject: [PATCH] git-common-dir: make submodule related variables worktree specific
Date: Thu, 2 Apr 2015 00:23:27 +0300 [thread overview]
Message-ID: <1427923407-7939-1-git-send-email-max@max630.net> (raw)
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
next reply other threads:[~2015-04-01 21:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 21:23 Max Kirillov [this message]
2015-04-01 21:28 ` [PATCH v2] git-common-dir: make submodule related variables worktree specific Max Kirillov
2015-04-01 21:45 ` [PATCH] " Max Kirillov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427923407-7939-1-git-send-email-max@max630.net \
--to=max@max630.net \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).