Submodules not treated properly leading to crash/failure
- Dominant language
- Python
- Stars
- 319
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
When commits include submodules, the respective dependencies cannot be resolved. The submodule commit OID contains the hash of the submodule commit. This commit is not present in the instance of the parent repo.
At the following place in the `tree_lookup`, this will lead to a `KeyError` being thrown:
https://github.com/aspiers/git-deps/blob/5dd7f4c4b6d4d771c5b6866b8256eb1bad632843/git_deps/detector.py#L344
A simple fix would be to check first whether the OID is contained in the repo and simply `return None` if it's not, something like this: https://github.com/fuulish/git-deps/commit/1c55add39712b77994a95fb0a68745a94cccde79
This ignores submodule dependencies. However, submodule-related changes are linearly dependent on their respective parent changes. Hence, a proper solution should include the actual dependency chain. One suggestion could be like the following: https://github.com/fuulish/git-deps/commit/2fd1455635a1f0882dd6e6733b6f6850155e7ce9
Let me know what you think.
Contributor guide
Research direction
Start in git_deps/detector.py at tree_lookup around line 344, then review the two referenced commits describing possible submodule handling. Confirm how missing submodule commit OIDs should be treated and whether parent changes must form a dependency chain; done means submodule commits no longer cause the reported crash and the intended dependency behavior is implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100