summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorGiel van Schijndel <Giel.vanSchijndel@tomtom.com>2021-01-13 15:23:41 +0100
committerSebastian Thiel <sebastian.thiel@icloud.com>2021-01-14 12:04:03 +0800
commit037d62a9966743cf7130193fa08d5182df251b27 (patch)
tree04599ed103e69ddce5ee6e7fe3c257c909f42bda /git
parentdd3cdfc9d647ecb020625351e0ff3a7346e1918d (diff)
downloadgitpython-037d62a9966743cf7130193fa08d5182df251b27.tar.gz
fix(fetch): use the correct FETCH_HEAD from within a worktree
FETCH_HEAD is one of the symbolic references local to the current worktree and as such should _not_ be looked up in the 'common_dir'. But instead of just hard coding the "right thing" (git_dir) lets defer this to the SymbolicReference class which already contains this knowledge in its 'abspath' property.
Diffstat (limited to 'git')
-rw-r--r--git/remote.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/git/remote.py b/git/remote.py
index 06e9d3b7..65916614 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -22,8 +22,6 @@ from git.util import (
join_path,
)
-import os.path as osp
-
from .config import (
SectionConstraint,
cp,
@@ -685,7 +683,8 @@ class Remote(LazyMixin, Iterable):
continue
# read head information
- with open(osp.join(self.repo.common_dir, 'FETCH_HEAD'), 'rb') as fp:
+ fetch_head = SymbolicReference(self.repo, "FETCH_HEAD")
+ with open(fetch_head.abspath, 'rb') as fp:
fetch_head_info = [line.decode(defenc) for line in fp.readlines()]
l_fil = len(fetch_info_lines)