Expand description
$EDITOR / $VISUAL spawn helper for mkit commit.
Behaviour:
- Honour
$GIT_EDITORfirst, then$EDITOR, then$VISUAL. - Fall back to
vion Unix /notepadon Windows when no env var is set, somkit commitworks out-of-the-box. - Write
templateto a tempfile, spawn the editor, wait, read the file back, strip any line whose first non-whitespace byte is#, and return the trimmed message.
Constants§
- COMMIT_
EDITMSG_ TEMPLATE - Template rendered into the tempfile before spawning the editor.
- MAX_
COMMIT_ MSG_ BYTES - Maximum commit-message file size read back from the editor (1 MiB).
Functions§
- spawn_
editor - Spawn the user’s editor on a tempfile pre-populated with
template, then read the file back, strip#-comment lines, and return the trimmed result. - strip_
comments_ and_ trim - Strip all lines whose first non-whitespace byte is
#, then trim trailing whitespace.