From: Kaartic Sivaraam Date: Fri, 07 Jul 2017 11:53:13 GMT Subject: Re: [PATCH] hooks: replace irrelevant hook sample Message-ID: <1499428393.1849.3.camel@gmail.com> In-Reply-To: On Wed, 2017-07-05 at 12:50 -0700, Junio C Hamano wrote: > Three things that caught my eyes: > >  - Between "git commit --cleanup=strip" and "git commit -- > cleanup=verbatim", >    lines that make up this initial instruction section are different. > >  - "git grep 'Please enter the '" finds that this string is subject >    to translation, so the pattern may not match (in which case it >    will be a no-op without doing any harm, which is OK). > >  - core.commentChar can be set to something other than '#', so the >    pattern may not match (I do not offhand know if that may cause a >    wrong line to match, causing harm, or not). > > As merely an example, it probably is OK to say "this won't work if > you are not using the C locale, and/or you are using custom > core.commentChar".  So if we disregard the latter two, I would think > >     sed -e '/^# Please enter the commit message /,/^#$/d' > > may be simpler to reason about to achieve the same goal.   > Thanks for enlightening me about this. I thought sed was greedy with address spaces the same way it's greedy with regex. sed -e '/^# Please enter the commit message /,/^#$/d' This command does seem to work regardless of the cleanup mode used. That said, in case my interpretation that "'prepare-commit-msg' hook is not to be shipped due to it's uselessness" is correct, the reply of this mail as a whole seems to contradict it. Should I work on this patch and another related one (he one that modifies the signature part of the hook) or should I drop it ? IOW, would this patch likely make the hook useful again? -- Kaartic