On Solaris, where /bin/sh is actually sh, not bash, some expressions
like $() are not supported. Git's own scripts on this machine are
configured to use "#!/bin/bash". Change our shebang line to
#!/usr/bin/env bash
which should work almost everywhere.
Stop processing the commit message text at a "diff --git" line. Such
lines occur when the user commits with the "-v" option. We should not
check the patch content; it will be stripped by Git anyway.
Store a backup copy of the input message. Remove the backup only on
success. On failure, tell the user how to use and edit the message
without having to enter it from scratch.