path: root/t/
diff options
authorStefan Beller <>2018-12-14 23:59:45 (GMT)
committerJunio C Hamano <>2018-12-26 18:39:54 (GMT)
commit8eda5efa1269a6117b86a97a309eb3a195b5f087 (patch)
tree15dd398c9b8d05d431988380b29866298a910185 /t/
parent820a647e67ad21ecb1d23b2154c44ad13e794443 (diff)
submodule deinit: unset core.worktree
When a submodule is deinit'd, the working tree is gone, so the setting of core.worktree is bogus. Unset it. As we covered the only other case in which a submodule loses its working tree in the earlier step (i.e. switching branches of top-level project to move to a commit that did not have the submodule), this makes the code always maintain core.worktree correctly unset when there is no working tree for a submodule. This re-introduces 984cd77ddb (submodule deinit: unset core.worktree, 2018-06-18), which was reverted as part of f178c13fda (Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07) The whole series was reverted as the offending commit e98317508c (submodule: ensure core.worktree is set after update, 2018-06-18) was relied on by other commits such as 984cd77ddb. Keep the offending commit reverted, but its functionality came back via 4d6d6ef1fc (Merge branch 'sb/submodule-update-in-c', 2018-09-17), such that we can reintroduce 984cd77ddb now. Signed-off-by: Stefan Beller <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 5 insertions, 0 deletions
diff --git a/t/ b/t/
index 76a7cb0..aba2d4d 100755
--- a/t/
+++ b/t/
@@ -984,6 +984,11 @@ test_expect_success 'submodule deinit should remove the whole submodule section
rmdir init
+test_expect_success 'submodule deinit should unset core.worktree' '
+ test_path_is_file .git/modules/example/config &&
+ test_must_fail git config -f .git/modules/example/config core.worktree
test_expect_success 'submodule deinit from subdirectory' '
git submodule update --init &&
git config bar &&