Skip to content

Commit 0affa33

Browse files
authored
update types submodule/base.py
1 parent c081f51 commit 0affa33

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

git/objects/submodule/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
563563
progress.update(op, i, len_rmts, prefix + "Done fetching remote of submodule %r" % self.name)
564564
# END fetch new data
565565
except InvalidGitRepositoryError:
566+
mrepo = None
566567
if not init:
567568
return self
568569
# END early abort if init is not allowed
@@ -603,7 +604,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
603604

604605
# make sure HEAD is not detached
605606
mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch)
606-
mrepo.head.ref.set_tracking_branch(remote_branch)
607+
mrepo.head.reference.set_tracking_branch(remote_branch)
607608
except (IndexError, InvalidGitRepositoryError):
608609
log.warning("Failed to checkout tracking branch %s", self.branch_path)
609610
# END handle tracking branch
@@ -629,13 +630,14 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
629630
if mrepo is not None and to_latest_revision:
630631
msg_base = "Cannot update to latest revision in repository at %r as " % mrepo.working_dir
631632
if not is_detached:
632-
rref = mrepo.head.ref.tracking_branch()
633+
rref = mrepo.head.reference.tracking_branch()
633634
if rref is not None:
634635
rcommit = rref.commit
635636
binsha = rcommit.binsha
636637
hexsha = rcommit.hexsha
637638
else:
638-
log.error("%s a tracking branch was not set for local branch '%s'", msg_base, mrepo.head.ref)
639+
log.error("%s a tracking branch was not set for local branch '%s'",
640+
msg_base, mrepo.head.reference)
639641
# END handle remote ref
640642
else:
641643
log.error("%s there was no local tracking branch", msg_base)

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