使用Python获取子模块的Git哈希值(首选pygit2)

问题描述 投票:0回答:1

我需要获得许多git项目的所有子模块的确切版本(git hash)。在git命令行中,我只需键入:git submodule并获取我想要的内容。我无法弄清楚如何从Python访问该信息。我目前正在使用Pygit2,但我只能使用repo.listall_submodules()获取子模块列表并使用repo.lookup_submodule(submodule)查找名称/ url。我仍然缺少子模块的githash。

python git git-submodules
1个回答
0
投票

好的,所需的API,git_submodule_head_id没有导出到Python绑定。我创建了一个PR来添加它。 https://github.com/libgit2/pygit2/pull/817

© www.soinside.com 2019 - 2024. All rights reserved.