diff options
author | Peter Jones <pjones@redhat.com> | 2017-08-03 17:33:07 -0400 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2017-08-22 17:12:54 -0400 |
commit | d1c40f46bd547be663b4cd97a80704279708ea8a (patch) | |
tree | 2a580fb08efbba0c9923fb0c93ee0a91fc179369 /git/remote.py | |
parent | cf8dc259fcc9c1397ea67cec3a6a4cb5816e3e68 (diff) | |
download | gitpython-d1c40f46bd547be663b4cd97a80704279708ea8a.tar.gz |
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 <pjones@redhat.com>
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/git/remote.py b/git/remote.py index fd76e592..29c7ed92 100644 --- a/git/remote.py +++ b/git/remote.py @@ -652,7 +652,7 @@ class Remote(LazyMixin, Iterable): continue # read head information - with open(osp.join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') as fp: + with open(osp.join(self.repo.common_dir, 'FETCH_HEAD'), 'rb') as fp: fetch_head_info = [l.decode(defenc) for l in fp.readlines()] l_fil = len(fetch_info_lines) |