Merge pull request #3652 from libgit2/cmn/commit-to-memory commit: split creating the commit and writing it out