Expose setting workdir and detatched HEADs

A couple new features that I need for a tool I'm working on (https://github.com/oconnor663/peru). I'm totally new to libgit2, so I'm sure I made mistakes here.

The next thing I need to expose is `git_merge_trees`. I'd appreciate any advice for where that belongs.