Guard against failures, or unexpect git rev-list output.

There's some magic that happens, and that requires git gc to be run before git rev-list provides useful and expected output.