On Tue, 14 Jan 2020, Joseph Myers wrote: > On Tue, 14 Jan 2020, Jakub Jelinek wrote: > > > (untested), another, suggested by Richard on IRC, would be to reject > > commits where the first line starts with whitespace. > > I'd suggest making the hooks reject whitespace at the start of the first > line of the commit message.
Unfortunately, that's not as simple to implement as I'd hoped, because git.py:git_run removes all leading and trailing whitespace from the output of the git command it runs, so the code checking commit messages can't tell whether there was whitespace at the start of the first line (or the end of the last line, I suppose) at all. I don't know what git commands the hooks are using that might depend on removing leading whitespace (no doubt the removal of trailing whitespace is needed in various places to remove a final newline output by commands giving single-line output). -- Joseph S. Myers jos...@codesourcery.com