Fixing checkout UPDATE_ONLY and adding tests

This adds a bunch of new checkout tests and in the process I found
a bug in the GIT_CHECKOUT_UPDATE_ONLY flag which I fixed.