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-introduces984cd77ddb
(submodule deinit: unset core.worktree, 2018-06-18), which was reverted as part off178c13fda
(Revert "Merge branch 'sb/submodule-core-worktree'", 2018-09-07) The whole series was reverted as the offending commite98317508c
(submodule: ensure core.worktree is set after update, 2018-06-18) was relied on by other commits such as984cd77ddb
. Keep the offending commit reverted, but its functionality came back via4d6d6ef1fc
(Merge branch 'sb/submodule-update-in-c', 2018-09-17), such that we can reintroduce984cd77ddb
now. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
820a647e67
commit
8eda5efa12
@ -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 submodule.example.foo bar &&
|
||||
|
Reference in New Issue
Block a user