Add refs.toFinalRef() to get terminal ref

* Maps master to refs/heads/master
* Maps HEAD to contents of HEAD file
Add refs.toHash() to get hash from ref or hash
Should throw if ref2 is hash that doesn't exist