Wrap `git_index_write_tree_to`

Fixes #312
Repository can't be nil.
Spacing fixes
Merge pull request #317 from PiersonBro/wrap-git_index_write_tree_to

Wrap `git_index_write_tree_to`