Improve error propagation in shallow call

`git_repository_is_shallow` was eating some errors, and not clearing the error in others. This patch makes this call propagate errors properly.