This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Whitespace at the start of first line of commit


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
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]