the git appication runs the editor application, and if the editor application returnes unsuccessfully (non-zero exitcode) the git application recognizes this and stops further processing.
in vim you can perform this with :cq!
from the vim manual:
:cq :cquit
:cq[uit][!] Quit Vim with an error code, so that the compiler
will not compile the same file again.
WARNING: All changes in files are lost! Also when the
[!] is not used. It works like ":qall!" :qall,
except that Vim returns a non-zero exit code.
this works for svn, too! the difference AFAIK between svn and git is, that svn don't like empty commit messages and stops when you quit with :q!
(even if the exitcode is 0) but for git this is ok. for both it is not ok, if the editor gives an non-zero exitcode.
exitcodes are a very fundamental concept in unix/linux and and easy way to inform the caller application if everyhing was ok (exitcode 0) or something went wrong.