Add a #dereference method to reference objects

This allows us to replicate the behavior of `git show-ref --dereference` without having to do a multi-step object lookup on the ruby side. 

Note, this is the first real C code I've written in ages. Please tear it apart if I'm not following style guides or anything. 

/cc @arrbee @brianmario