t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees test

The 'denyCurrentBranch and worktrees' test creates a 'cloned' and a 'new-wt' but it doesn't clean them after the test. This makes other tests that use the same name after this one to fail. Add test_when_finished to clean them at the end. Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pablo Sabater committed Mar 30, 2026 at 13:18 UTC b310755ecaf4459eddd4f602b3cb02e793c01177
1 file changed +1
t/t5516-fetch-push.sh
+1
@@ -1792,6 +1792,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '
1792 '
1793
1794 test_expect_success 'denyCurrentBranch and worktrees' '
1795 + test_when_finished "rm -fr cloned && git worktree remove --force new-wt" &&
1796 git worktree add new-wt &&
1797 git clone . cloned &&
1798 test_commit -C cloned first &&