On 01/04/2011 02:29 PM, Eric Blake wrote: >> +# Just before tagging a release, ensure that the gnulib submodule >> +# commit we're using is public. >> +alpha beta stable: gnulib-commit-check >> +.PHONY: gnulib-commit-check >> +gnulib-commit-check: >> + submod=gnulib; \ >> + st=$$(git submodule status $$submod) || exit 1; \ >> + commit=$$(echo $$st | awk '{ print $$1 }') || exit 1; \ >> + wget -q -O /dev/null \ >> + "http://git.savannah.gnu.org/gitweb/?p=$$submod.git;a=tree;h=$$commit" > > I'm trying to come up with some > git submodule foreach 'command $sha1' > formula that will allow you to make the same check without having to > resort to wget or even to hardcoding the URL of each upstream repository.
Found one, and it even works on libvirt (where the gnulib submodule is named .gnulib instead of gnulib). It should also work on a repository with multiple submodules, although I have not yet tested it on bison.git. gnulib-commit-check: git submodule foreach test '$$(git merge-base --independent \ origin $$sha1 | wc -w)' = 1 This effectively runs the shell command: git merge-base --independent origin $sha1 with $sha1 set to the value recorded in the superproject (identical to your computation of $commit), and outputs the minimal set of revisions not reachable from any other in the set of arguments. If origin contains $sha1, the output is a single hash (it happens to be that of origin); if $sha1 is a local-only revision, the output is two hashes, so the test fails, which in turn lets 'make alpha' fail. No need for wget, awk, or a hardcoded URL :) -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature