commit: Fix potential segfault in git_commit_message

Dereferencing commit pointer before asserting
Merge pull request #1994 from palistov/commit-cleanup

commit: Fix potential segfault