Commit f51a2c74 by David Hotham Committed by GitHub

fix: skip cloning badly defined submodules

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.
parent dc36158c
...@@ -334,7 +334,7 @@ class Git: ...@@ -334,7 +334,7 @@ class Git:
url: bytes url: bytes
path: bytes path: bytes
submodules = parse_submodules(config) submodules = parse_submodules(config)
for path, url, _ in submodules: for path, url, name in submodules:
path_relative = Path(path.decode("utf-8")) path_relative = Path(path.decode("utf-8"))
path_absolute = repo_root.joinpath(path_relative) path_absolute = repo_root.joinpath(path_relative)
...@@ -342,7 +342,16 @@ class Git: ...@@ -342,7 +342,16 @@ class Git:
source_root.mkdir(parents=True, exist_ok=True) source_root.mkdir(parents=True, exist_ok=True)
with repo: 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( cls.clone(
url=url.decode("utf-8"), url=url.decode("utf-8"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment