def test_git_work_tree_dotgit(self, rw_dir):
        """Check that we find .git as a worktree file and find the worktree
        based on it."""
        git = Git(rw_dir)
        if git.version_info[:3] < (2, 5, 1):
            raise RuntimeError("worktree feature unsupported (test needs git 2.5.1 or later)")

        rw_master = self.rorepo.clone(join_path_native(rw_dir, "master_repo"))
        branch = rw_master.create_head("aaaaaaaa")
        worktree_path = join_path_native(rw_dir, "worktree_repo")
        if Git.is_cygwin():
            worktree_path = cygpath(worktree_path)
        rw_master.git.worktree("add", worktree_path, branch.name)

        # This ensures that we can read the repo's gitdir correctly.
        repo = Repo(worktree_path)
        self.assertIsInstance(repo, Repo)

        # This ensures we're able to actually read the refs in the tree, which means we
        # can read commondir correctly.
        commit = repo.head.commit
        self.assertIsInstance(commit, Object)

        # This ensures we can read the remotes, which confirms we're reading the config
        # correctly.
        origin = repo.remotes.origin
        self.assertIsInstance(origin, Remote)

        self.assertIsInstance(repo.heads["aaaaaaaa"], Head)
Check that we find .git as a worktree file and find the worktree
        based on it.
test/test_repo.py