Added argument checking in checkout function

* src/git2r.c (checkout): Added argument checking in checkout
  function. More work required to complete checkout functionality.
Changed checkout treeish argument from NULL to 'HEAD'
Refactoring of checkout argument checking

* src/git2r.c (checkout): More work to fix checkout functionality
Merged ongoing work with checkout functionality