Eric Blake wrote:

> On 01/04/2011 03:01 PM, Eric Blake wrote:
>> 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.
>
> Not quite robust enough - if your superproject contains commits not
> pushed upstream yet, then merge-base would still output a single
> reference.  This should close that gap, by requiring that the least
> reachable commit be exactly the upstream origin.
>
> gnulib-commit-check:
>       git submodule foreach test '$$(git rev-parse origin)' \
>         = '"$$(git merge-base --independent origin $$sha1)"'

Sounds nice.  Thanks!
I'll take a look this evening.

Reply via email to