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-
import os.path as osp
26-
2725
from .config import (
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-
with open(osp.join(self.repo.common_dir, 'FETCH_HEAD'), 'rb') as fp:
686+
fetch_head = SymbolicReference(self.repo, "FETCH_HEAD")
687+
with open(fetch_head.abspath, 'rb') as fp:
689688
fetch_head_info = [line.decode(defenc) for line in fp.readlines()]
690689

691690
l_fil = len(fetch_info_lines)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy