Use submodule --reference when availiable

This checks to see if there's a /var/cache/git and uses it as a
reference for submodules when it exists.
Support running --check --master

It turns out there was a slightly odd bit of parsing I had to do to
make this combination of options work.
Add a simple integration test script

The idea here is that I want to call this from the buildbot, but I
want a single script so I don't forgot what arguments I'm running.