Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.
There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
Before, the commit-msg hook would not catch too long lines when
squashing commits, as the provided message starts immediately with a
commented line.
Instead of simply using all lines until the first comment, use all lines
until git's cut-line and remove all commented lines in between.
Do not hard-code git's commentary character but rather use
`core.commentChar`. `auto` is depending of the context interpreted as
'any character' or `#`.
I have no idea how I have not noticed this yet, as apparently every time
I wrote a commit message that contains a body and not just a subject I
got an error message complaining that the first word does not exist as a
command. (With the exception of when it actually is, but then executing
arbitrary code)
The changes are only shown in the editor and do not land in the final
commit message.
For that setting the git-commit-last-msg function and the commit-msg
hook had to be updated.
The function is now a standalone function instead of anonymous and
uses every line until the first comment in COMMIT_EDITMSG discarding the
new information too.
The hook breaks now when checking line lengths when the changes start
since for some weird reason they are passed together with the rest of
the message instead of being deleted like the comments.
Refactor commit-msg to reduce redundancies by splitting up the pattern
into the different 'levels'.
For the array the change from /bin/sh to /bin/bash was necessary.
Because of that: Change all `test` occurrences to [[ ]] for performance.