This is the mail archive of the
mailing list for the GCC project.
Re: Whitespace at the start of first line of commit
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, Joel Brobecker <brobecker at adacore dot com>
- Date: Wed, 15 Jan 2020 17:09:01 +0000
- Subject: Re: Whitespace at the start of first line of commit
- Ironport-sdr: h1LJXKQgRdEiLzXyAxVnI7d/d4ogN+ndC24GSBDDIGZ1aRaRX/qZeshfA7hY/W0LEg0V7essJ7 hGlrvb+fwV5Gbq31SIS7Y8CiR+DmgJvm+CSUUD4+nG4B1I2zwWKliMS9OT7SjZ4AJN6XMsQjIQ 0RBB8/lnoQUSS5rzyCKl3d1Ncvsa9PbKR5MRR2maXKMuTDhvnEPEcw/X6y3GH6XWqu1yQ3IBgp fwLPfDcPFlgBCbCih7IqDRlwE6s+l6phfIzmNJRh+D1zel9G3Oi+lZTtgTQOiTddJG3YG9Wigp 780=
- Ironport-sdr: rwwKh1NiQQzFKh10/vs2RagwpHFSr2Y7VPpsVF20p6bSEORmeAYcYjuFh3UGh7pgeLqL0lgt+4 hiL8nymA7ltulUqAOBkGI5qZRh3cZ7OjN3SIu9t+e9JBv1a58hyWm9BeeJ0ji9LjqdZQ+BLt0n uQZbTL11hzLJWmHwalr68dBiH+GuKIlTPPTAU33Uh7mGrBLND8a5omozC04PQzsDseTSiVb42+ AtqS04hGngi8rL3N9eR+qObfjKg9G0aInyaCkDD9oi8JdG8gtJ+8qiDvU9s9wlgoumoGGwg787 qLs=
- References: <20200114102902.GA10088@tucnak> <alpine.DEB.email@example.com>
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