summaryrefslogtreecommitdiff
path: root/t/t7410-submodule-checkout-to.sh
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2015-09-13 22:17:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-14 18:03:46 (GMT)
commit11f9dd719104a960d3e2b478477d9055141d1dbc (patch)
treea8a9549888fdfe7acda74ad4a0fed457c2f8c55e /t/t7410-submodule-checkout-to.sh
parent35fb4d2e3d4a3cd008ec0baa077939f60a64f244 (diff)
downloadgit-11f9dd719104a960d3e2b478477d9055141d1dbc.zip
git-11f9dd719104a960d3e2b478477d9055141d1dbc.tar.gz
git-11f9dd719104a960d3e2b478477d9055141d1dbc.tar.bz2
path: implement common_dir handling in git_pathdup_submodule()
When submodule is a linked worktree, "git diff --submodule" and other calls which directly access the submodule's object database do not correctly calculate its path. Fix it by changing the git_pathdup_submodule() behavior, to use either common or per-worktree directory. Do it similarly as for parent repository, but ignore the GIT_COMMON_DIR environment variable, because it would mean common directory for the parent repository and does not make sense for submodule. Also add test for functionality which uses this call. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7410-submodule-checkout-to.sh')
-rwxr-xr-xt/t7410-submodule-checkout-to.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t7410-submodule-checkout-to.sh b/t/t7410-submodule-checkout-to.sh
index 3f609e8..1acef32 100755
--- a/t/t7410-submodule-checkout-to.sh
+++ b/t/t7410-submodule-checkout-to.sh
@@ -47,4 +47,14 @@ test_expect_success 'checkout main and initialize independed clones' \
test_expect_success 'can see submodule diffs after independed cloning' \
'(cd fully_cloned_submodule/main && git diff --submodule master"^!" | grep "file1 updated")'
+test_expect_success 'checkout sub manually' \
+ 'mkdir linked_submodule &&
+ (cd clone/main &&
+ git worktree add "$base_path/linked_submodule/main" "$rev1_hash_main") &&
+ (cd clone/main/sub &&
+ git worktree add "$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")'
+
test_done