diff options
author | Stefan Beller <sbeller@google.com> | 2018-06-12 16:58:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-14 14:13:46 -0700 |
commit | 4fa4f90ccd85842e1187e5a5daf4633dceaab779 (patch) | |
tree | ee43fe2b82b49e9488c87f2462acf322791058cd /t | |
parent | Git 2.18-rc2 (diff) | |
download | tgif-4fa4f90ccd85842e1187e5a5daf4633dceaab779.tar.xz |
submodule: unset core.worktree if no working tree is present
When a submodules work tree is removed, we should unset its core.worktree
setting as the worktree is no longer present. This is not just in line
with the conceptual view of submodules, but it fixes an inconvenience
for looking at submodules that are not checked out:
git clone --recurse-submodules git://github.com/git/git && cd git &&
git checkout --recurse-submodules v2.13.0
git -C .git/modules/sha1collisiondetection log
fatal: cannot chdir to '../../../sha1collisiondetection': \
No such file or directory
With this patch applied, the final call to git log works instead of dying
in its setup, as the checkout will unset the core.worktree setting such
that following log will be run in a bare repository.
This patch covers all commands that are in the unpack machinery, i.e.
checkout, read-tree, reset. A follow up patch will address
"git submodule deinit", which will also make use of the new function
submodule_unset_core_worktree(), which is why we expose it in this patch.
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/lib-submodule-update.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 1f38a85371..12cd4e9233 100755 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -709,7 +709,8 @@ test_submodule_recursing_with_args_common() { git branch -t remove_sub1 origin/remove_sub1 && $command remove_sub1 && test_superproject_content origin/remove_sub1 && - ! test -e sub1 + ! test -e sub1 && + test_must_fail git config -f .git/modules/sub1/config core.worktree ) ' # ... absorbing a .git directory along the way. |