diff options
author | Philippe Blain <levraiphilippeblain@gmail.com> | 2019-10-27 20:16:25 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-30 03:57:15 +0300 |
commit | 4782cf2ab686bacca8d2908319981ac27d54ca25 (patch) | |
tree | f2ba37df193ff94f8fa3a44bf6f35eae508a07bd /t/t2400-worktree-add.sh | |
parent | 5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9 (diff) |
worktree: teach "add" to ignore submodule.recurse config
"worktree add" internally calls "reset --hard", but if
submodule.recurse is set, reset tries to recurse into
initialized submodules, which makes start_command try to
cd into non-existing submodule paths and die.
Fix that by making sure that the call to reset in "worktree add"
does not recurse.
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2400-worktree-add.sh')
-rwxr-xr-x | t/t2400-worktree-add.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index e819ba741e..8a9831413c 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -587,4 +587,28 @@ test_expect_success '"add" should not fail because of another bad worktree' ' ) ' +test_expect_success '"add" with uninitialized submodule, with submodule.recurse unset' ' + test_create_repo submodule && + test_commit -C submodule first && + test_create_repo project && + git -C project submodule add ../submodule && + git -C project add submodule && + test_tick && + git -C project commit -m add_sub && + git clone project project-clone && + git -C project-clone worktree add ../project-2 +' +test_expect_success '"add" with uninitialized submodule, with submodule.recurse set' ' + git -C project-clone -c submodule.recurse worktree add ../project-3 +' + +test_expect_success '"add" with initialized submodule, with submodule.recurse unset' ' + git -C project-clone submodule update --init && + git -C project-clone worktree add ../project-4 +' + +test_expect_success '"add" with initialized submodule, with submodule.recurse set' ' + git -C project-clone -c submodule.recurse worktree add ../project-5 +' + test_done |