Merge pull request #2310 from libgit2/cmn/commit-create-safe commit: safer commit creation with reference update