Re: [PATCH 1/6] templates: Use heredoc in pre-commit hook
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:09
Jonathan Nieder [off-list ref] writes:
quoted
Based on 98770971aef8d1cbc78876d9023d10aa25df0526 in original patch series from 2013-06-10.Please don't include this. The audience for the commit message doesn't have that commit to compare to. If you want to preserve the original date, the way to do that is a "Date:" field at the top of the message body. Date: Fri, 28 Jun 2013 21:16:19 +0530
And you generally should not do that, either. The first date of the publication of _this_ version is recorded on the Date: header of this message, not the "original path series" that this round which is _based on_ (meaning, "different from") that old one. We do not want to see the date of the old one, either.
Spawning a new subprocess for ... [...]quoted
--- a/templates/hooks--pre-commit.sample +++ b/templates/hooks--pre-commit.sample@@ -31,18 +31,19 @@ if [ "$allownonascii" != "true" ] && test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 then - echo "Error: Attempt to add a non-ascii file name." - echo - echo "This can cause problems if you want to work" - echo "with people on other platforms." - echo - echo - echo "If you know what you are doing you can disable this" - echo "check using:" - echo - echo " git config hooks.allownonascii true" - echo + cat <<-EOF +Error: Attempt to add a non-ascii file name.Using cat <<\EOF would make reading easier since the reader then doesn't have to worry about whether the text being cat'ed is indented or uses variable substitutions.quoted
- echo "To be portable it is advisable to rename the file ..." +To be portable it is advisable to rename the file.Yes, nice. With the above nits addressed, this change looks to be going in the right direction. Thanks. Hope that helps, Jonathan