'Create a new worktree using git-worktree.
:param repo_dir: The directory of the main working tree.
:param branch: The branch or commit to checkout in the new worktree.
:returns: The path to the new working tree.'

def create_new_worktree(self, repo_dir, branch):

    temp_dir = tempfile.mkdtemp()
    run_git_or_fail(['worktree', 'add', temp_dir, branch], cwd=repo_dir)
    self.addCleanup(rmtree_ro, temp_dir)
    return temp_dir
