Allow objects of type Branch to be passed to Repository.checkout()

Branch inherits from Reference, so there's no reason why we shouldn't be
able to pass a Branch object.
Add test for checking out local branches with a Branch object.

This differs from the only other test which uses a Reference object.
This test only succeeds because of the previous commit.
Merge remote-tracking branch 'djmattyg007/branches_are_references'