Skip to content

Commit 037d62a

Browse files
GielVanSchijndel-TomTomByron
authored andcommitted
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.
1 parent dd3cdfc commit 037d62a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

‎git/remote.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
join_path,
2323
)
2424

25-
importos.pathasosp
26-
2725
from .configimport (
2826
SectionConstraint,
2927
cp,
@@ -685,7 +683,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
685683
continue
686684

687685
# read head information
688-
withopen(osp.join(self.repo.common_dir, 'FETCH_HEAD'), 'rb') asfp:
686+
fetch_head=SymbolicReference(self.repo, "FETCH_HEAD")
687+
withopen(fetch_head.abspath, 'rb') asfp:
689688
fetch_head_info= [line.decode(defenc) forlineinfp.readlines()]
690689

691690
l_fil=len(fetch_info_lines)

0 commit comments

Comments
(0)