Skip to content

Commit

Permalink
fix: skip cloning badly defined submodules
Browse files Browse the repository at this point in the history
eg with this dependency
```
pyscf = { git = "https://github.com/pyscf/pyscf", tag = "v2.0.1"}
```
the cloning of submodules fails - because that project has messed up and not committed the file saying what revision they want of the `doc` submodule.

Legacy git client just silently carries on, so I've done the same here.
  • Loading branch information
dimbleby authored and neersighted committed Aug 31, 2022
1 parent e3ae93a commit 3092769
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/poetry/vcs/git/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,24 @@ def _clone_submodules(cls, repo: Repo) -> None:
url: bytes
path: bytes
submodules = parse_submodules(config)
for path, url, _ in submodules:
for path, url, name in submodules:
path_relative = Path(path.decode("utf-8"))
path_absolute = repo_root.joinpath(path_relative)

source_root = path_absolute.parent
source_root.mkdir(parents=True, exist_ok=True)

with repo:
revision = repo.open_index()[path].sha.decode("utf-8")
try:
revision = repo.open_index()[path].sha.decode("utf-8")
except KeyError:
logger.debug(
"Skip submodule %s in %s, path %s not found",
name,
repo.path,
path,
)
continue

cls.clone(
url=url.decode("utf-8"),
Expand Down

0 comments on commit 3092769

Please sign in to comment.