I want to determine the associated SHA-1 of a submodule without cloning anything - i.e. remotely. git-ls-remote doesn't show this information, so my initial approach was to scrape the XHTML from gitweb and pull the SHA-1 out of there.
Unfortunately, gitweb seems to have pretty poor support for submodules, showing 404 and 500 "unknown object" errors when trying to view history for the associated path. Therefore it does not seem possible to me to determine the associated SHA-1 of a submodule unless I can identify the exact commit that modified the git-link and then parse the diff for something like:
-Subproject commit 706187649544cb029b617548771fe96c1693be39
+Subproject commit f05b9854fca9a2e1f47449e563a33156c1085646
Unfortunately gitweb is so broken with submodules that I can't find a way to determine which commit contains this diff, so unless I do an exhaustive search back through each commit, it's a no-go.
I've tried with gitweb bundled with git 1.6.4.2 and 1.6.6.1 (latest stable).
Can anyone think of a solution, or perhaps an alternative way to do this without having to clone each repository. You see, I want to do this for all repositories in our organisation, and for every branch within each repository, and that's a lot of branches. I'm doing this to get a list of all submodule commits and determine if any are out-of-date.
If the only solution is to individually clone each repository and run queries within, then that will have to be it. Unfortunately some of our repositories are quite large so this will make the entire operation very slow.