From d1c40f46bd547be663b4cd97a80704279708ea8a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 3 Aug 2017 17:33:07 -0400 Subject: worktrees: make non-packed refs also work correctly. Turns out aec58a9 did the right thing for /packed/ refs, but didn't work correctly on /unpacked/ refs. So this patch gives unpacked refs the same treatment. Without the fix here, the test added will cause this traceback: ====================================================================== ERROR: Check that we find .git as a worktree file and find the worktree ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pjones/devel/github.com/GitPython/git/test/lib/helper.py", line 92, in wrapper return func(self, path) File "/home/pjones/devel/github.com/GitPython/git/test/test_repo.py", line 938, in test_git_work_tree_dotgit self.assertIsInstance(repo.heads['aaaaaaaa'], Head) File "/home/pjones/devel/github.com/GitPython/git/util.py", line 893, in __getitem__ raise IndexError("No item found with id %r" % (self._prefix + index)) IndexError: No item found with id 'aaaaaaaa' Woops. Things I've learned: - test_remote doesn't work currently if you start on a branch. I think it never did? - Because of 346424da, all *sorts* of stuff in the test suite doesn't work if you name your development branch "packed-refs" (This seems like a bug...) Signed-off-by: Peter Jones --- git/test/test_repo.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'git/test/test_repo.py') diff --git a/git/test/test_repo.py b/git/test/test_repo.py index a6be4e66..312e67f9 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -935,6 +935,8 @@ class TestRepo(TestBase): commit = repo.head.commit self.assertIsInstance(commit, Object) + self.assertIsInstance(repo.heads['aaaaaaaa'], Head) + @with_rw_directory def test_git_work_tree_env(self, rw_dir): """Check that we yield to GIT_WORK_TREE""" -- cgit v1.2.1