4

我想在不克隆任何东西的情况下确定子模块的关联 SHA-1 - 即远程。git-ls-remote 没有显示这些信息,所以我最初的方法是从 gitweb 中抓取 XHTML 并将 SHA-1 拉出那里。

不幸的是,gitweb 似乎对子模块的支持很差,在尝试查看关联路径的历史记录时显示 404 和 500“未知对象”错误。因此,我似乎无法确定子模块的关联 SHA-1,除非我可以确定修改 git-link 的确切提交,然后解析差异,例如:

-Subproject commit 706187649544cb029b617548771fe96c1693be39
+Subproject commit f05b9854fca9a2e1f47449e563a33156c1085646

不幸的是 gitweb 被子模块破坏了,我无法找到一种方法来确定哪个提交包含这个差异,所以除非我对每个提交进行详尽的搜索,否则这是不行的。

我已经尝试将 gitweb 与 git 1.6.4.2 和 1.6.6.1(最新稳定版)捆绑在一起。

任何人都可以想到一个解决方案,或者可能是一种替代方法来做到这一点,而不必克隆每个存储库。你看,我想为我们组织中的所有存储库以及每个存储库中的每个分支执行此操作,这是很多分支。我这样做是为了获取所有子模块提交的列表并确定是否有任何已过时。

如果唯一的解决方案是单独克隆每个存储库并在其中运行查询,那么就必须这样做。不幸的是,我们的一些存储库非常大,因此这将使整个操作非常缓慢。

4

1 回答 1

1

I'm not sure if it would give you the answer you want:

Take a look at 'tree' view in gitweb1 for a directory that contains submodule (this might be top dir of your repository). You can recognize submodule by the fact that it has m--------- as mode string. For each submodule you should have 'history' link, where you would have list of all commits that changed given submodule. (This requires gitweb at least from git version 1.5.3).

The lack of better submodule support in gitweb is, I think, caused by the fact that it is hard to detect where repository (the git_dir) for a submodule is.

HTH

Footnotes:
1. It would help if you have provided link to gitweb installation, if it could be made public.

于 2010-02-05T13:43:30.330 回答