{"thread":{"id":"14125","subject":"[PATCH] pre-commit hook should ignore carriage returns at EOL","startedAt":"2008-06-24T16:23:38Z","lastAt":"2008-06-26T07:28:50Z","messageCount":21,"participants":["Christian Holtje","Alf Clement","Ian Hilt","Jakub Narebski","Junio C Hamano","Peter Baumann","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"80919","messageId":"53A5AFCF-94C7-465E-A181-1DA69F251F5B@gmail.com","threadId":"14125","inReplyTo":null,"subject":"[PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Christian Holtje","fromEmail":"docwhat@gmail.com","sentAt":"2008-06-24T16:23:38Z","receivedAt":"2008-06-24T16:23:38Z","isPatch":true,"sender":{"key":"docwhat@gmail.com","avatar":"https://gravatar.com/avatar/b87944ebf1ff49feaeefaa1c19a6e98baee691c531ecb860c2bc4f63b464a395?d=mp&s=160"},"body":"When commit files that use DOS style CRLF end-of-lines, the pre-commit\nhook would raise an error.  When combined with the fact that the hooks\nget activated by default on windows, it makes life difficult for\npeople working with DOS files.\n\nThis patch causes the pre-commit hook to deal with crlf files\ncorrectly.\n\nSigned-off-by: Christian H√∂ltje <docwhat@gmail.com>\n---\n  t/t7503-template-hook--pre-commit.sh |   75 +++++++++++++++++++++++++ \n+++++++++\n  templates/hooks--pre-commit          |   10 ++++-\n  2 files changed, 83 insertions(+), 2 deletions(-)\n  create mode 100755 t/t7503-template-hook--pre-commit.sh\n\ndiff --git a/t/t7503-template-hook--pre-commit.sh b/t/t7503-template- \nhook--pre-commit.sh\nnew file mode 100755\nindex 0000000..8f0c3c9\n--- /dev/null\n+++ b/t/t7503-template-hook--pre-commit.sh\n@@ -0,0 +1,75 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2008 Christian H√∂ltje\n+#\n+\n+test_description='t7503 templates-hooks--pre-commit\n+\n+This test verifies that the pre-commit hook shipped with\n+git by default works correctly.\n+'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'verify that autocrlf is unset' '\n+   if git config core.autocrlf\n+   then\n+     false\n+   else\n+     test $? -eq 1\n+   fi\n+'\n+\n+test_expect_success 'lf without hook' '\n+\n+\techo \"foo\" > lf.txt &&\n+\tgit add lf.txt &&\n+\tgit commit -m \"lf without hook\" lf.txt\n+\n+'\n+\n+test_expect_success 'crlf without hook' '\n+\n+\techo \"foo\\r\" > crlf.txt &&\n+\tgit add crlf.txt &&\n+\tgit commit -m \"crlf without hook\" crlf.txt\n+\n+'\n+\n+# Set up the pre-commit hook.\n+HOOKDIR=\"$(git rev-parse --git-dir)/hooks\"\n+mkdir -p \"${HOOKDIR}\"\n+cp -r \"${HOOKDIR}-disabled/pre-commit\" \"${HOOKDIR}/pre-commit\"\n+chmod +x \"${HOOKDIR}/pre-commit\"\n+\n+test_expect_success 'lf with hook' '\n+\n+\techo \"bar\" >> lf.txt &&\n+\tgit add lf.txt &&\n+\tgit commit -m \"lf with hook\" lf.txt\n+\n+'\n+test_expect_success 'crlf with hook' '\n+\n+\techo \"bar\\r\" >> crlf.txt &&\n+\tgit add crlf.txt &&\n+\tgit commit -m \"crlf with hook\" crlf.txt\n+\n+'\n+\n+test_expect_success 'lf with hook white-space failure' '\n+\n+\techo \"bar \" >> lf.txt &&\n+\tgit add lf.txt &&\n+\t! git commit -m \"lf with hook\" lf.txt\n+\n+'\n+test_expect_success 'crlf with hook white-space failure' '\n+\n+\techo \"bar \\r\" >> crlf.txt &&\n+\tgit add crlf.txt &&\n+\t! git commit -m \"crlf with hook\" crlf.txt\n+\n+'\n+\n+test_done\ndiff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit\nindex b25dce6..335ca09 100644\n--- a/templates/hooks--pre-commit\n+++ b/templates/hooks--pre-commit\n@@ -55,8 +55,14 @@ perl -e '\n  \tif (s/^\\+//) {\n  \t    $lineno++;\n  \t    chomp;\n-\t    if (/\\s$/) {\n-\t\tbad_line(\"trailing whitespace\", $_);\n+\t    if (/\\r$/) {\n+\t\tif (/\\s\\r$/) {\n+\t\t    bad_line(\"trailing whitespace\", $_);\n+\t\t}\n+\t    } else {\n+\t\tif (/\\s$/) {\n+\t\t    bad_line(\"trailing whitespace\", $_);\n+\t\t}\n  \t    }\n  \t    if (/^\\s* \\t/) {\n  \t\tbad_line(\"indent SP followed by a TAB\", $_);\n-- \n1.5.5.4\n"},{"id":"80939","messageId":"556d90580806241122i5e38ebf0ma7c60a7d3a6f5225@mail.gmail.com","threadId":"14125","inReplyTo":"53A5AFCF-94C7-465E-A181-1DA69F251F5B@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Alf Clement","fromEmail":"alf.clement@gmail.com","sentAt":"2008-06-24T18:22:32Z","receivedAt":"2008-06-24T18:22:32Z","isPatch":true,"sender":{"key":"alf.clement@gmail.com","avatar":null},"body":"Hi Christian,\n\nthanks for the patch. I use git under Windows and also run often into\nthese problems,\nbecause I have to (but don't like to) use come compilers under Windows.\nI usually comment the two bad_lines() in the pre-commit-hook out by hand:\n\"trailing whitespace\" and \"indent SP followed by TAB\", because i.e.\nVisual Studio writes some files out, which trigger these checks.\n\nCan't we get rid of these checks?\n\nCU,\nAlf\n\nOn 6/24/08, Christian Holtje <docwhat@gmail.com> wrote:\n> When commit files that use DOS style CRLF end-of-lines, the pre-commit\n> hook would raise an error.  When combined with the fact that the hooks\n> get activated by default on windows, it makes life difficult for\n> people working with DOS files.\n>\n> This patch causes the pre-commit hook to deal with crlf files\n> correctly.\n>\n> Signed-off-by: Christian H√∂ltje <docwhat@gmail.com>\n> ---\n>   t/t7503-template-hook--pre-commit.sh |   75 +++++++++++++++++++++++++\n> +++++++++\n>   templates/hooks--pre-commit          |   10 ++++-\n>   2 files changed, 83 insertions(+), 2 deletions(-)\n>   create mode 100755 t/t7503-template-hook--pre-commit.sh\n>\n> diff --git a/t/t7503-template-hook--pre-commit.sh b/t/t7503-template-\n> hook--pre-commit.sh\n> new file mode 100755\n> index 0000000..8f0c3c9\n> --- /dev/null\n> +++ b/t/t7503-template-hook--pre-commit.sh\n> @@ -0,0 +1,75 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2008 Christian H√∂ltje\n> +#\n> +\n> +test_description='t7503 templates-hooks--pre-commit\n> +\n> +This test verifies that the pre-commit hook shipped with\n> +git by default works correctly.\n> +'\n> +\n> +. ./test-lib.sh\n> +\n> +test_expect_success 'verify that autocrlf is unset' '\n> +   if git config core.autocrlf\n> +   then\n> +     false\n> +   else\n> +     test $? -eq 1\n> +   fi\n> +'\n> +\n> +test_expect_success 'lf without hook' '\n> +\n> +\techo \"foo\" > lf.txt &&\n> +\tgit add lf.txt &&\n> +\tgit commit -m \"lf without hook\" lf.txt\n> +\n> +'\n> +\n> +test_expect_success 'crlf without hook' '\n> +\n> +\techo \"foo\\r\" > crlf.txt &&\n> +\tgit add crlf.txt &&\n> +\tgit commit -m \"crlf without hook\" crlf.txt\n> +\n> +'\n> +\n> +# Set up the pre-commit hook.\n> +HOOKDIR=\"$(git rev-parse --git-dir)/hooks\"\n> +mkdir -p \"${HOOKDIR}\"\n> +cp -r \"${HOOKDIR}-disabled/pre-commit\" \"${HOOKDIR}/pre-commit\"\n> +chmod +x \"${HOOKDIR}/pre-commit\"\n> +\n> +test_expect_success 'lf with hook' '\n> +\n> +\techo \"bar\" >> lf.txt &&\n> +\tgit add lf.txt &&\n> +\tgit commit -m \"lf with hook\" lf.txt\n> +\n> +'\n> +test_expect_success 'crlf with hook' '\n> +\n> +\techo \"bar\\r\" >> crlf.txt &&\n> +\tgit add crlf.txt &&\n> +\tgit commit -m \"crlf with hook\" crlf.txt\n> +\n> +'\n> +\n> +test_expect_success 'lf with hook white-space failure' '\n> +\n> +\techo \"bar \" >> lf.txt &&\n> +\tgit add lf.txt &&\n> +\t! git commit -m \"lf with hook\" lf.txt\n> +\n> +'\n> +test_expect_success 'crlf with hook white-space failure' '\n> +\n> +\techo \"bar \\r\" >> crlf.txt &&\n> +\tgit add crlf.txt &&\n> +\t! git commit -m \"crlf with hook\" crlf.txt\n> +\n> +'\n> +\n> +test_done\n> diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit\n> index b25dce6..335ca09 100644\n> --- a/templates/hooks--pre-commit\n> +++ b/templates/hooks--pre-commit\n> @@ -55,8 +55,14 @@ perl -e '\n>   \tif (s/^\\+//) {\n>   \t    $lineno++;\n>   \t    chomp;\n> -\t    if (/\\s$/) {\n> -\t\tbad_line(\"trailing whitespace\", $_);\n> +\t    if (/\\r$/) {\n> +\t\tif (/\\s\\r$/) {\n> +\t\t    bad_line(\"trailing whitespace\", $_);\n> +\t\t}\n> +\t    } else {\n> +\t\tif (/\\s$/) {\n> +\t\t    bad_line(\"trailing whitespace\", $_);\n> +\t\t}\n>   \t    }\n>   \t    if (/^\\s* \\t/) {\n>   \t\tbad_line(\"indent SP followed by a TAB\", $_);\n> --\n> 1.5.5.4\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"80940","messageId":"alpine.LFD.1.10.0806241418360.32759@sys-0.hiltweb.site","threadId":"14125","inReplyTo":"53A5AFCF-94C7-465E-A181-1DA69F251F5B@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Ian Hilt","fromEmail":"ian.hilt@gmx.com","sentAt":"2008-06-24T18:26:17Z","receivedAt":"2008-06-24T18:26:17Z","isPatch":true,"sender":{"key":"ian.hilt@gmx.com","avatar":null},"body":"On Tue, 24 Jun 2008 at 12:23pm -0400, Christian Holtje wrote:\n\n> When commit files that use DOS style CRLF end-of-lines, the pre-commit\n> hook would raise an error.  When combined with the fact that the hooks\n> get activated by default on windows, it makes life difficult for\n> people working with DOS files.\n> \n> This patch causes the pre-commit hook to deal with crlf files\n> correctly.\n> \n> Signed-off-by: Christian H√∂ltje <docwhat@gmail.com>\n> ---\n> t/t7503-template-hook--pre-commit.sh |   75 ++++++++++++++++++++++++++++++++++\n> templates/hooks--pre-commit          |   10 ++++-\n> 2 files changed, 83 insertions(+), 2 deletions(-)\n> create mode 100755 t/t7503-template-hook--pre-commit.sh\n> \n> diff --git a/t/t7503-template-hook--pre-commit.sh\n> b/t/t7503-template-hook--pre-commit.sh\n> new file mode 100755\n> index 0000000..8f0c3c9\n> --- /dev/null\n> +++ b/t/t7503-template-hook--pre-commit.sh\n> @@ -0,0 +1,75 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2008 Christian H√∂ltje\n> +#\n> +\n> +test_description='t7503 templates-hooks--pre-commit\n> +\n> +This test verifies that the pre-commit hook shipped with\n> +git by default works correctly.\n> +'\n> +\n> +. ./test-lib.sh\n> +\n> +test_expect_success 'verify that autocrlf is unset' '\n> +   if git config core.autocrlf\n> +   then\n> +     false\n> +   else\n> +     test $? -eq 1\n> +   fi\n> +'\n> +\n> +test_expect_success 'lf without hook' '\n> +\n> +\techo \"foo\" > lf.txt &&\n> +\tgit add lf.txt &&\n> +\tgit commit -m \"lf without hook\" lf.txt\n> +\n> +'\n> +\n> +test_expect_success 'crlf without hook' '\n> +\n> +\techo \"foo\\r\" > crlf.txt &&\n\nPerhaps you want to use printf \"foo\\r\" instead?  echo \"foo\\r\" does not\nproduce a CR on my system.\n\n> +\tgit add crlf.txt &&\n> +\tgit commit -m \"crlf without hook\" crlf.txt\n> +\n> +'\n> +\n> +# Set up the pre-commit hook.\n> +HOOKDIR=\"$(git rev-parse --git-dir)/hooks\"\n> +mkdir -p \"${HOOKDIR}\"\n> +cp -r \"${HOOKDIR}-disabled/pre-commit\" \"${HOOKDIR}/pre-commit\"\n> +chmod +x \"${HOOKDIR}/pre-commit\"\n> +\n> +test_expect_success 'lf with hook' '\n> +\n> +\techo \"bar\" >> lf.txt &&\n> +\tgit add lf.txt &&\n> +\tgit commit -m \"lf with hook\" lf.txt\n> +\n> +'\n> +test_expect_success 'crlf with hook' '\n> +\n> +\techo \"bar\\r\" >> crlf.txt &&\n> +\tgit add crlf.txt &&\n> +\tgit commit -m \"crlf with hook\" crlf.txt\n> +\n> +'\n> +\n> +test_expect_success 'lf with hook white-space failure' '\n> +\n> +\techo \"bar \" >> lf.txt &&\n> +\tgit add lf.txt &&\n> +\t! git commit -m \"lf with hook\" lf.txt\n> +\n> +'\n> +test_expect_success 'crlf with hook white-space failure' '\n> +\n> +\techo \"bar \\r\" >> crlf.txt &&\n> +\tgit add crlf.txt &&\n> +\t! git commit -m \"crlf with hook\" crlf.txt\n> +\n> +'\n> +\n> +test_done\n> diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit\n> index b25dce6..335ca09 100644\n> --- a/templates/hooks--pre-commit\n> +++ b/templates/hooks--pre-commit\n> @@ -55,8 +55,14 @@ perl -e '\n> \tif (s/^\\+//) {\n> \t    $lineno++;\n> \t    chomp;\n> -\t    if (/\\s$/) {\n> -\t\tbad_line(\"trailing whitespace\", $_);\n> +\t    if (/\\r$/) {\n\nWouldn't it be less redundant to do a test for \\s\\r$ here instead of\ntesting for \\r$ and then \\s\\r$?\n\n> +\t\tif (/\\s\\r$/) {\n> +\t\t    bad_line(\"trailing whitespace\", $_);\n> +\t\t}\n> +\t    } else {\n> +\t\tif (/\\s$/) {\n> +\t\t    bad_line(\"trailing whitespace\", $_);\n> +\t\t}\n> \t    }\n> \t    if (/^\\s* \\t/) {\n> \t\tbad_line(\"indent SP followed by a TAB\", $_);\n> \n\n-- \nIan Hilt\nIan.Hilt (at) gmx.com\nGnuPG key: 0x4AFC1EE3"},{"id":"80947","messageId":"m363rylknc.fsf@localhost.localdomain","threadId":"14125","inReplyTo":"alpine.LFD.1.10.0806241418360.32759@sys-0.hiltweb.site","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-24T19:05:32Z","receivedAt":"2008-06-24T19:05:32Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ian Hilt <Ian.Hilt@gmx.com> writes:\n\n> On Tue, 24 Jun 2008 at 12:23pm -0400, Christian Holtje wrote:\n\n> > --- a/templates/hooks--pre-commit\n> > +++ b/templates/hooks--pre-commit\n> > @@ -55,8 +55,14 @@ perl -e '\n> > \tif (s/^\\+//) {\n> > \t    $lineno++;\n> > \t    chomp;\n> > -\t    if (/\\s$/) {\n> > -\t\tbad_line(\"trailing whitespace\", $_);\n> > +\t    if (/\\r$/) {\n> \n> Wouldn't it be less redundant to do a test for \\s\\r$ here instead of\n> testing for \\r$ and then \\s\\r$?\n\nI don't think so, because you want next to test for whitespace\nwhere it _doesn't_ end in \\r, i.e. this condition is here\nbecause of the 'else' clause.  IIRC.\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"80954","messageId":"39C2861E-F800-40AE-8C15-4FC3BB51EF16@gmail.com","threadId":"14125","inReplyTo":"alpine.LFD.1.10.0806241418360.32759@sys-0.hiltweb.site","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Christian Holtje","fromEmail":"docwhat@gmail.com","sentAt":"2008-06-24T19:16:07Z","receivedAt":"2008-06-24T19:16:07Z","isPatch":true,"sender":{"key":"docwhat@gmail.com","avatar":"https://gravatar.com/avatar/b87944ebf1ff49feaeefaa1c19a6e98baee691c531ecb860c2bc4f63b464a395?d=mp&s=160"},"body":"On Jun 24, 2008, at 2:26 PM, Ian Hilt wrote:\n> Perhaps you want to use printf \"foo\\r\" instead?  echo \"foo\\r\" does not\n> produce a CR on my system.\n\n...\n\n> Wouldn't it be less redundant to do a test for \\s\\r$ here instead of\n> testing for \\r$ and then \\s\\r$?\n\n\nThe code is checking for \\r$ and then doing a different space check  \ndepending on that, not one after another.\n\nThanks for the feedback. I'll put up v2 in a second.\n\nCiao!\n"},{"id":"80969","messageId":"alpine.LFD.1.10.0806241548140.32759@sys-0.hiltweb.site","threadId":"14125","inReplyTo":"m363rylknc.fsf@localhost.localdomain","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Ian Hilt","fromEmail":"ian.hilt@gmx.com","sentAt":"2008-06-24T19:54:49Z","receivedAt":"2008-06-24T19:54:49Z","isPatch":true,"sender":{"key":"ian.hilt@gmx.com","avatar":null},"body":"On Tue, 24 Jun 2008 at 12:05pm -0700, Jakub Narebski wrote:\n\n> I don't think so, because you want next to test for whitespace\n> where it _doesn't_ end in \\r, i.e. this condition is here\n> because of the 'else' clause.  IIRC.\n\nWhat I'm suggesting is this,\n\n\tif (/\\s\\r$/) {\n\t\tbad_line(\"trailing whitespace\", $_);\n\t} else {\n\t\tif (/\\s$/) {\n\t\t\tbad_line(\"trailing whitespace\", $_);\n\t\t}\n\t}\n\nWhy only test for \\r when all you want to know is whether there is\nwhitespace before \\r ?  If there isn't whitespace and \\r at the end of a\nline, then only test for whitespace at the end of a line.\n\n\n-- \nIan Hilt\nIan.Hilt (at) gmx.com\nGnuPG key: 0x4AFC1EE3\n"},{"id":"80973","messageId":"200806242209.07135.jnareb@gmail.com","threadId":"14125","inReplyTo":"alpine.LFD.1.10.0806241548140.32759@sys-0.hiltweb.site","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-24T20:09:06Z","receivedAt":"2008-06-24T20:09:06Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 24 Jun 2008, Ian Hilt wrote:\n> On Tue, 24 Jun 2008 at 12:05pm -0700, Jakub Narebski wrote:\n> \n> > I don't think so, because you want next to test for whitespace\n> > where it _doesn't_ end in \\r, i.e. this condition is here\n> > because of the 'else' clause.  IIRC.\n> \n> What I'm suggesting is this,\n> \n> \tif (/\\s\\r$/) {\n> \t\tbad_line(\"trailing whitespace\", $_);\n> \t} else {\n> \t\tif (/\\s$/) {\n> \t\t\tbad_line(\"trailing whitespace\", $_);\n> \t\t}\n> \t}\n> \n> Why only test for \\r when all you want to know is whether there is\n> whitespace before \\r ?  If there isn't whitespace and \\r at the end\n> of a line, then only test for whitespace at the end of a line.\n\nUnfortunately \\r matches \\s (is whitespace), so if line ends with CR LF\n(\"\\r\\n\") it wouldn't match first regexp, so it would go to 'else' \nclause, where it would match /\\s$/ and it shouldn't.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"80979","messageId":"alpine.LFD.1.10.0806241634590.32759@sys-0.hiltweb.site","threadId":"14125","inReplyTo":"200806242209.07135.jnareb@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Ian Hilt","fromEmail":"ian.hilt@gmx.com","sentAt":"2008-06-24T20:36:12Z","receivedAt":"2008-06-24T20:36:12Z","isPatch":true,"sender":{"key":"ian.hilt@gmx.com","avatar":null},"body":"On Tue, 24 Jun 2008 at 10:09pm +0200, Jakub Narebski wrote:\n\n> Unfortunately \\r matches \\s (is whitespace), so if line ends with CR LF\n> (\"\\r\\n\") it wouldn't match first regexp, so it would go to 'else' \n> clause, where it would match /\\s$/ and it shouldn't.\n\nRight.  Sorry for the noise.\n\n-- \nIan Hilt\nIan.Hilt (at) gmx.com\nGnuPG key: 0x4AFC1EE3\n"},{"id":"80999","messageId":"7v3an2bh3b.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"39C2861E-F800-40AE-8C15-4FC3BB51EF16@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-24T22:31:20Z","receivedAt":"2008-06-24T22:31:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Holtje <docwhat@gmail.com> writes:\n\n> The code is checking for \\r$ and then doing a different space check\n> depending on that, not one after another.\n>\n> Thanks for the feedback. I'll put up v2 in a second.\n\nPlease don't.\n\nIt's an ancient sample hook that is not be enabled by default.  I do not\nwant people to be wasting too much time on the relic.\n\nHowever, if this sample is to be changed at all, please do it right.\n\nIf somebody suddenly adds CR at the end of an existing file that ought to\nhave LF line endings, we _DO_ want to catch that as a breakage.  So the\ntitle of the commit \"should ignore carriage returns at EOL\" is WRONG.  It\nshouldn't, in general.\n\nOne thing the hook could and probably should do these days is if the file\ntype says you _ought to_ have CRLF line endings, actively make sure your\nlines do end with CRLF (this is a much stronger and better check than\nblindly ignoring CR before LF for such files).  And on the other hand, if\nthe file should end with LF, do make sure it does not have CR before it.\n\nThe person who did the sample hook you are looking at couldn't do so\nbecause there weren't autocrlf nor gitattributes(5) facility back then.\nBut you can use them now to rewrite this properly.\n\nI wonder if \"git diff --check\" can be used for most if not all of the\nchecking, without the big Perl script you are touching in your patch.\nThat facility did not exist when the current sample hook was written,\neither.\n"},{"id":"81018","messageId":"930163B6-4A7E-49C7-B9D5-F7B37699C2A9@gmail.com","threadId":"14125","inReplyTo":"7v3an2bh3b.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Christian Holtje","fromEmail":"docwhat@gmail.com","sentAt":"2008-06-24T23:25:40Z","receivedAt":"2008-06-24T23:25:40Z","isPatch":true,"sender":{"key":"docwhat@gmail.com","avatar":"https://gravatar.com/avatar/b87944ebf1ff49feaeefaa1c19a6e98baee691c531ecb860c2bc4f63b464a395?d=mp&s=160"},"body":"\nOn Jun 24, 2008, at 6:31 PM, Junio C Hamano wrote:\n\n> Christian Holtje <docwhat@gmail.com> writes:\n>\n>> The code is checking for \\r$ and then doing a different space check\n>> depending on that, not one after another.\n>>\n>> Thanks for the feedback. I'll put up v2 in a second.\n>\n> Please don't.\n>\n> It's an ancient sample hook that is not be enabled by default.  I do  \n> not\n> want people to be wasting too much time on the relic\n\nPart of the reason I'm fixing this is because it *is* enabled by  \ndefault in windows.  I don't know why, but cygwin always marks it with  \nexecutable.\n\n> However, if this sample is to be changed at all, please do it right.\n>\n> If somebody suddenly adds CR at the end of an existing file that  \n> ought to\n> have LF line endings, we _DO_ want to catch that as a breakage.  So  \n> the\n> title of the commit \"should ignore carriage returns at EOL\" is  \n> WRONG.  It\n> shouldn't, in general.\n>\n> One thing the hook could and probably should do these days is if the  \n> file\n> type says you _ought to_ have CRLF line endings, actively make sure  \n> your\n> lines do end with CRLF (this is a much stronger and better check than\n> blindly ignoring CR before LF for such files).  And on the other  \n> hand, if\n> the file should end with LF, do make sure it does not have CR before  \n> it.\n>\n> The person who did the sample hook you are looking at couldn't do so\n> because there weren't autocrlf nor gitattributes(5) facility back  \n> then.\n> But you can use them now to rewrite this properly.\n\nHow can I detect if a file should have CRLF vs. LF?  I didn't do a  \nbetter check because I didn't know how.\n\n> I wonder if \"git diff --check\" can be used for most if not all of the\n> checking, without the big Perl script you are touching in your patch.\n> That facility did not exist when the current sample hook was written,\n> either.\n\nI like that better.  Ditching the whole perl script in a shell script  \nseems better.\n\nI wrote a test case for what you describe above (a crlf file with an  \nlf line or a lf file with a crlf) but \"git diff --check\" doesn't catch  \nthat.\n\nBased on the information about core.whitespace doesn't git do this  \nalready?  Maybe we should just delete the pre-commit hook or make it  \nempty with a note saying what you can do with it?\n\nCiao!\n"},{"id":"81022","messageId":"m3k5gejtkp.fsf@localhost.localdomain","threadId":"14125","inReplyTo":"930163B6-4A7E-49C7-B9D5-F7B37699C2A9@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-06-24T23:34:35Z","receivedAt":"2008-06-24T23:34:35Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Christian Holtje <docwhat@gmail.com> writes:\n\n> Based on the information about core.whitespace doesn't git do this\n> already?  Maybe we should just delete the pre-commit hook or make it\n> empty with a note saying what you can do with it?\n\npre-commit hook also detects unresolved merge conflicts, which\ncore.whitespace doesn't (and probably shouldn't).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"81024","messageId":"7vbq1q9zct.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"m3k5gejtkp.fsf@localhost.localdomain","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-24T23:39:46Z","receivedAt":"2008-06-24T23:39:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Christian Holtje <docwhat@gmail.com> writes:\n>\n>> Based on the information about core.whitespace doesn't git do this\n>> already?  Maybe we should just delete the pre-commit hook or make it\n>> empty with a note saying what you can do with it?\n>\n> pre-commit hook also detects unresolved merge conflicts, which\n> core.whitespace doesn't (and probably shouldn't).\n\nBut perhaps \"diff --check\" should.\n"},{"id":"81027","messageId":"7v4p7i9ygd.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"930163B6-4A7E-49C7-B9D5-F7B37699C2A9@gmail.com","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-24T23:59:14Z","receivedAt":"2008-06-24T23:59:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Holtje <docwhat@gmail.com> writes:\n\n> On Jun 24, 2008, at 6:31 PM, Junio C Hamano wrote:\n> ...\n>> It's an ancient sample hook that is not be enabled by default.  I do\n>> not want people to be wasting too much time on the relic.\n>\n> Part of the reason I'm fixing this is because it *is* enabled by\n> default in windows.  I don't know why, but cygwin always marks it with\n> executable.\n\nThat's a packaging issue, and I've always wanted to see fixes related to\nplatform specific packaging issues come from people who _need_ fixes on\ntheir platforms.  I have been waiting forever for that to happen without\ncomplaining to them.  I was hoping some enlightened people will emerge\neven from Windows camps, waiting patiently.\n\nBut I ran out of patience, and I am finally fed up waiting.\n\nHow about doing this everywhere, not just on Windows, for 1.6.0?\n\n-- >8 --\n[PATCH] Ship sample hooks with .sample suffix\n\nWe used to mark hooks we ship as samples by making them unexecutable, but\nsome filesystems cannot tell what is executable and what is not.\n\nThis makes it much more explicit.  The hooks are suffixed with .sample\n(but now are made executable), so enabling it is still one step operation\n(instead of \"chmod +x $hook\", you would do \"mv $hook.sample $hook\") but\nnow they won't get accidentally enabled on systems without executable bit.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n Documentation/githooks.txt                         |    3 ++-\n ...applypatch-msg => hooks--applypatch-msg.sample} |    0\n ...{hooks--commit-msg => hooks--commit-msg.sample} |    0\n ...ooks--post-commit => hooks--post-commit.sample} |    0\n ...ks--post-receive => hooks--post-receive.sample} |    0\n ...ooks--post-update => hooks--post-update.sample} |    0\n ...pre-applypatch => hooks--pre-applypatch.sample} |    0\n ...{hooks--pre-commit => hooks--pre-commit.sample} |    0\n ...{hooks--pre-rebase => hooks--pre-rebase.sample} |    0\n ...commit-msg => hooks--prepare-commit-msg.sample} |    0\n templates/{hooks--update => hooks--update.sample}  |    0\n 11 files changed, 2 insertions(+), 1 deletions(-)\n rename templates/{hooks--applypatch-msg => hooks--applypatch-msg.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--commit-msg => hooks--commit-msg.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--post-commit => hooks--post-commit.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--post-receive => hooks--post-receive.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--post-update => hooks--post-update.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-applypatch => hooks--pre-applypatch.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-commit => hooks--pre-commit.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-rebase => hooks--pre-rebase.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--prepare-commit-msg => hooks--prepare-commit-msg.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--update => hooks--update.sample} (100%)\n mode change 100644 => 100755\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex 4f06ae0..262a4f1 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -17,7 +17,8 @@ Hooks are little scripts you can place in `$GIT_DIR/hooks`\n directory to trigger action at certain points.  When\n `git-init` is run, a handful example hooks are copied in the\n `hooks` directory of the new repository, but by default they are\n-all disabled.  To enable a hook, make it executable with `chmod +x`.\n+all disabled.  To enable a hook, rename it by removing its `.sample`\n+suffix.\n \n This document describes the currently defined hooks.\n \ndiff --git a/templates/hooks--applypatch-msg b/templates/hooks--applypatch-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--applypatch-msg\nrename to templates/hooks--applypatch-msg.sample\ndiff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--commit-msg\nrename to templates/hooks--commit-msg.sample\ndiff --git a/templates/hooks--post-commit b/templates/hooks--post-commit.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--post-commit\nrename to templates/hooks--post-commit.sample\ndiff --git a/templates/hooks--post-receive b/templates/hooks--post-receive.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--post-receive\nrename to templates/hooks--post-receive.sample\ndiff --git a/templates/hooks--post-update b/templates/hooks--post-update.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--post-update\nrename to templates/hooks--post-update.sample\ndiff --git a/templates/hooks--pre-applypatch b/templates/hooks--pre-applypatch.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--pre-applypatch\nrename to templates/hooks--pre-applypatch.sample\ndiff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--pre-commit\nrename to templates/hooks--pre-commit.sample\ndiff --git a/templates/hooks--pre-rebase b/templates/hooks--pre-rebase.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--pre-rebase\nrename to templates/hooks--pre-rebase.sample\ndiff --git a/templates/hooks--prepare-commit-msg b/templates/hooks--prepare-commit-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--prepare-commit-msg\nrename to templates/hooks--prepare-commit-msg.sample\ndiff --git a/templates/hooks--update b/templates/hooks--update.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--update\nrename to templates/hooks--update.sample\n"},{"id":"81030","messageId":"8EDBCDE3-1155-4C44-B3BF-FB7F16AC9AE8@gmail.com","threadId":"14125","inReplyTo":"7vbq1q9zct.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] pre-commit hook should ignore carriage returns at EOL","fromName":"Christian Holtje","fromEmail":"docwhat@gmail.com","sentAt":"2008-06-25T00:19:17Z","receivedAt":"2008-06-25T00:19:17Z","isPatch":true,"sender":{"key":"docwhat@gmail.com","avatar":"https://gravatar.com/avatar/b87944ebf1ff49feaeefaa1c19a6e98baee691c531ecb860c2bc4f63b464a395?d=mp&s=160"},"body":"\nOn Jun 24, 2008, at 7:39 PM, Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n>\n>> Christian Holtje <docwhat@gmail.com> writes:\n>>\n>>> Based on the information about core.whitespace doesn't git do this\n>>> already?  Maybe we should just delete the pre-commit hook or make it\n>>> empty with a note saying what you can do with it?\n>>\n>> pre-commit hook also detects unresolved merge conflicts, which\n>> core.whitespace doesn't (and probably shouldn't).\n>\n> But perhaps \"diff --check\" should.\n>\n\ndefinitely; that sounds like an obvious thing for \"diff --check\".\n\nCiao!\n"},{"id":"81034","messageId":"7vtzfi8dvk.fsf_-_@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"7v4p7i9ygd.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Ship sample hooks with .sample suffix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-25T02:09:03Z","receivedAt":"2008-06-25T02:09:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We used to mark hooks we ship as samples by making them unexecutable, but\nsome filesystems cannot tell what is executable and what is not.\n\nThis makes it much more explicit.  The hooks are suffixed with .sample\n(but now are made executable), so enabling it is still one step operation\n(instead of \"chmod +x $hook\", you would do \"mv $hook.sample $hook\") but\nnow they won't get accidentally enabled on systems without executable bit.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * This is for actual application.  Hopefully I got all the \"to enable\n   this hook, make it executable\" in the samples right.\n\n Documentation/githooks.txt                         |    3 ++-\n ...applypatch-msg => hooks--applypatch-msg.sample} |    2 +-\n ...{hooks--commit-msg => hooks--commit-msg.sample} |    2 +-\n ...ooks--post-commit => hooks--post-commit.sample} |    2 +-\n ...ks--post-receive => hooks--post-receive.sample} |   13 ++++++-------\n ...ooks--post-update => hooks--post-update.sample} |    2 +-\n ...pre-applypatch => hooks--pre-applypatch.sample} |    2 +-\n ...{hooks--pre-commit => hooks--pre-commit.sample} |    2 +-\n ...{hooks--pre-rebase => hooks--pre-rebase.sample} |    0\n ...commit-msg => hooks--prepare-commit-msg.sample} |    2 +-\n templates/{hooks--update => hooks--update.sample}  |    2 +-\n 11 files changed, 16 insertions(+), 16 deletions(-)\n rename templates/{hooks--applypatch-msg => hooks--applypatch-msg.sample} (86%)\n mode change 100644 => 100755\n rename templates/{hooks--commit-msg => hooks--commit-msg.sample} (93%)\n mode change 100644 => 100755\n rename templates/{hooks--post-commit => hooks--post-commit.sample} (63%)\n mode change 100644 => 100755\n rename templates/{hooks--post-receive => hooks--post-receive.sample} (40%)\n mode change 100644 => 100755\n rename templates/{hooks--post-update => hooks--post-update.sample} (63%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-applypatch => hooks--pre-applypatch.sample} (84%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-commit => hooks--pre-commit.sample} (96%)\n mode change 100644 => 100755\n rename templates/{hooks--pre-rebase => hooks--pre-rebase.sample} (100%)\n mode change 100644 => 100755\n rename templates/{hooks--prepare-commit-msg => hooks--prepare-commit-msg.sample} (94%)\n mode change 100644 => 100755\n rename templates/{hooks--update => hooks--update.sample} (97%)\n mode change 100644 => 100755\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex 4f06ae0..262a4f1 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -17,7 +17,8 @@ Hooks are little scripts you can place in `$GIT_DIR/hooks`\n directory to trigger action at certain points.  When\n `git-init` is run, a handful example hooks are copied in the\n `hooks` directory of the new repository, but by default they are\n-all disabled.  To enable a hook, make it executable with `chmod +x`.\n+all disabled.  To enable a hook, rename it by removing its `.sample`\n+suffix.\n \n This document describes the currently defined hooks.\n \ndiff --git a/templates/hooks--applypatch-msg b/templates/hooks--applypatch-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 86%\nrename from templates/hooks--applypatch-msg\nrename to templates/hooks--applypatch-msg.sample\nindex 02de1ef..8b2a2fe\n--- a/templates/hooks--applypatch-msg\n+++ b/templates/hooks--applypatch-msg.sample\n@@ -7,7 +7,7 @@\n # appropriate message if it wants to stop the commit.  The hook is\n # allowed to edit the commit message file.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"applypatch-msg\".\n \n . git-sh-setup\n test -x \"$GIT_DIR/hooks/commit-msg\" &&\ndiff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 93%\nrename from templates/hooks--commit-msg\nrename to templates/hooks--commit-msg.sample\nindex 4ef86eb..6ef1d29\n--- a/templates/hooks--commit-msg\n+++ b/templates/hooks--commit-msg.sample\n@@ -6,7 +6,7 @@\n # status after issuing an appropriate message if it wants to stop the\n # commit.  The hook is allowed to edit the commit message file.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"commit-msg\".\n \n # Uncomment the below to add a Signed-off-by line to the message.\n # Doing this in a hook is a bad idea in general, but the prepare-commit-msg\ndiff --git a/templates/hooks--post-commit b/templates/hooks--post-commit.sample\nold mode 100644\nnew mode 100755\nsimilarity index 63%\nrename from templates/hooks--post-commit\nrename to templates/hooks--post-commit.sample\nindex 8be6f34..2266821\n--- a/templates/hooks--post-commit\n+++ b/templates/hooks--post-commit.sample\n@@ -3,6 +3,6 @@\n # An example hook script that is called after a successful\n # commit is made.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"post-commit\".\n \n : Nothing\ndiff --git a/templates/hooks--post-receive b/templates/hooks--post-receive.sample\nold mode 100644\nnew mode 100755\nsimilarity index 40%\nrename from templates/hooks--post-receive\nrename to templates/hooks--post-receive.sample\nindex b70c8fd..18d2e0f\n--- a/templates/hooks--post-receive\n+++ b/templates/hooks--post-receive.sample\n@@ -1,16 +1,15 @@\n #!/bin/sh\n #\n-# An example hook script for the post-receive event\n+# An example hook script for the \"post-receive\" event.\n #\n-# This script is run after receive-pack has accepted a pack and the\n-# repository has been updated.  It is passed arguments in through stdin\n-# in the form\n+# The \"post-receive\" script is run after receive-pack has accepted a pack\n+# and the repository has been updated.  It is passed arguments in through\n+# stdin in the form\n #  <oldrev> <newrev> <refname>\n # For example:\n #  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master\n #\n-# see contrib/hooks/ for an sample, or uncomment the next line (on debian)\n-#\n-\n+# see contrib/hooks/ for an sample, or uncomment the next line and\n+# rename the file to \"post-receive\".\n \n #. /usr/share/doc/git-core/contrib/hooks/post-receive-email\ndiff --git a/templates/hooks--post-update b/templates/hooks--post-update.sample\nold mode 100644\nnew mode 100755\nsimilarity index 63%\nrename from templates/hooks--post-update\nrename to templates/hooks--post-update.sample\nindex bcba893..5323b56\n--- a/templates/hooks--post-update\n+++ b/templates/hooks--post-update.sample\n@@ -3,6 +3,6 @@\n # An example hook script to prepare a packed repository for use over\n # dumb transports.\n #\n-# To enable this hook, make this file executable by \"chmod +x post-update\".\n+# To enable this hook, rename this file to \"post-update\".\n \n exec git-update-server-info\ndiff --git a/templates/hooks--pre-applypatch b/templates/hooks--pre-applypatch.sample\nold mode 100644\nnew mode 100755\nsimilarity index 84%\nrename from templates/hooks--pre-applypatch\nrename to templates/hooks--pre-applypatch.sample\nindex eeccc93..b1f187c\n--- a/templates/hooks--pre-applypatch\n+++ b/templates/hooks--pre-applypatch.sample\n@@ -6,7 +6,7 @@\n # The hook should exit with non-zero status after issuing an\n # appropriate message if it wants to stop the commit.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"pre-applypatch\".\n \n . git-sh-setup\n test -x \"$GIT_DIR/hooks/pre-commit\" &&\ndiff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit.sample\nold mode 100644\nnew mode 100755\nsimilarity index 96%\nrename from templates/hooks--pre-commit\nrename to templates/hooks--pre-commit.sample\nindex b25dce6..71c10f2\n--- a/templates/hooks--pre-commit\n+++ b/templates/hooks--pre-commit.sample\n@@ -5,7 +5,7 @@\n # exit with non-zero status after issuing an appropriate message if\n # it wants to stop the commit.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"pre-commit\".\n \n # This is slightly modified from Andrew Morton's Perfect Patch.\n # Lines you introduce should not have trailing whitespace.\ndiff --git a/templates/hooks--pre-rebase b/templates/hooks--pre-rebase.sample\nold mode 100644\nnew mode 100755\nsimilarity index 100%\nrename from templates/hooks--pre-rebase\nrename to templates/hooks--pre-rebase.sample\ndiff --git a/templates/hooks--prepare-commit-msg b/templates/hooks--prepare-commit-msg.sample\nold mode 100644\nnew mode 100755\nsimilarity index 94%\nrename from templates/hooks--prepare-commit-msg\nrename to templates/hooks--prepare-commit-msg.sample\nindex d3c1da3..aa42acf\n--- a/templates/hooks--prepare-commit-msg\n+++ b/templates/hooks--prepare-commit-msg.sample\n@@ -7,7 +7,7 @@\n # message file.  If the hook fails with a non-zero status,\n # the commit is aborted.\n #\n-# To enable this hook, make this file executable.\n+# To enable this hook, rename this file to \"prepare-commit-msg\".\n \n # This hook includes three examples.  The first comments out the\n # \"Conflicts:\" part of a merge commit.\ndiff --git a/templates/hooks--update b/templates/hooks--update.sample\nold mode 100644\nnew mode 100755\nsimilarity index 97%\nrename from templates/hooks--update\nrename to templates/hooks--update.sample\nindex 4b69268..93c6055\n--- a/templates/hooks--update\n+++ b/templates/hooks--update.sample\n@@ -3,7 +3,7 @@\n # An example hook script to blocks unannotated tags from entering.\n # Called by git-receive-pack with arguments: refname sha1-old sha1-new\n #\n-# To enable this hook, make this file executable by \"chmod +x update\".\n+# To enable this hook, rename this file to \"update\".\n #\n # Config\n # ------\n-- \n1.5.6.56.g29b0d\n"},{"id":"81037","messageId":"7vod5q8c25.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"7vtzfi8dvk.fsf_-_@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-25T02:48:18Z","receivedAt":"2008-06-25T02:48:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I'll queue the patch to 'master' and I suspect that this will make 31d6632\n(Windows: Change the name of hook scripts to make them not executable.,\n2007-11-30) unnecessary.\n\nI've looked at diff between ee1e0a3 (the original \"pull\" request) and\n8fd39ba (after WS fixup on borrowed code and other changes).\n\nThey all looked fine except for git.c::main() where do .. while does not\nhave a { } around the body (which is not required by C language but it\njust looked funny).\n\nI am very tempted to pull MinGW series directly to 'master', or at least\nto 'next', perhaps after dropping 31d6632.  What's your confidence level\non the series?  I think we should give this series extra priority so that\nany potential issues with other series (like dr/ceil) that do pathname\ntraversal will become more apparent sooner rather than later.\n"},{"id":"81067","messageId":"20080625051854.GA11813@m62s10.vlinux.de","threadId":"14125","inReplyTo":"7vtzfi8dvk.fsf_-_@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2008-06-25T05:18:54Z","receivedAt":"2008-06-25T05:18:54Z","isPatch":true,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Tue, Jun 24, 2008 at 07:09:03PM -0700, Junio C Hamano wrote:\n> We used to mark hooks we ship as samples by making them unexecutable, but\n> some filesystems cannot tell what is executable and what is not.\n> \n> This makes it much more explicit.  The hooks are suffixed with .sample\n> (but now are made executable), so enabling it is still one step operation\n> (instead of \"chmod +x $hook\", you would do \"mv $hook.sample $hook\") but\n> now they won't get accidentally enabled on systems without executable bit.\n> \n\nWouldn't it be better to name the hooks $hook.deactivated so its obvious\nto anybody that they are not executed? Just my 2 cents.\n\n-Peter\n"},{"id":"81083","messageId":"1214376700.4861eafc43b36@webmail.eunet.at","threadId":"14125","inReplyTo":"7vod5q8c25.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2008-06-25T06:51:40Z","receivedAt":"2008-06-25T06:51:40Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Zitat von Junio C Hamano <gitster@pobox.com>:\n> I am very tempted to pull MinGW series directly to 'master', or at least\n> to 'next', perhaps after dropping 31d6632.  What's your confidence level\n> on the series?  I think we should give this series extra priority so that\n> any potential issues with other series (like dr/ceil) that do pathname\n> traversal will become more apparent sooner rather than later.\n\nI am very confident in the series as far as using it on Windows is concerned.\nBut I must admit that I have started to use it on Linux only recently.\nTherefore, cooking it in 'next' for a few days is probably not a mistake.\n\n-- Hannes\n"},{"id":"81091","messageId":"7v4p7i3pi1.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"1214376700.4861eafc43b36@webmail.eunet.at","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-25T08:09:10Z","receivedAt":"2008-06-25T08:09:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> I am very confident in the series as far as using it on Windows is concerned.\n> But I must admit that I have started to use it on Linux only recently.\n> Therefore, cooking it in 'next' for a few days is probably not a mistake.\n\nThe question obviously was about using outside Windows context as we have\nbeen talking about merging it into my history ;-)\n\nI'll push out the master with the *.sample patch hopefully soon.\n"},{"id":"81245","messageId":"486342F8.2060406@viscovery.net","threadId":"14125","inReplyTo":"7vod5q8c25.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-06-26T07:19:20Z","receivedAt":"2008-06-26T07:19:20Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> I'll queue the patch to 'master' and I suspect that this will make 31d6632\n> (Windows: Change the name of hook scripts to make them not executable.,\n> 2007-11-30) unnecessary.\n\nI've updated\n\ngit://repo.or.cz/git/mingw/j6t.git for-junio\n\nand the interdiff to the previous version is merely the reverse of\n31d6632. For your convenience I've merged it into current next:\n\ngit://repo.or.cz/git/mingw/j6t.git merge-mingw-into-next\n\n-- Hannes\n"},{"id":"81246","messageId":"7vy74sslhp.fsf@gitster.siamese.dyndns.org","threadId":"14125","inReplyTo":"486342F8.2060406@viscovery.net","subject":"Re: [PATCH] Ship sample hooks with .sample suffix","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-26T07:28:50Z","receivedAt":"2008-06-26T07:28:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Junio C Hamano schrieb:\n>> I'll queue the patch to 'master' and I suspect that this will make 31d6632\n>> (Windows: Change the name of hook scripts to make them not executable.,\n>> 2007-11-30) unnecessary.\n>\n> I've updated\n>\n> git://repo.or.cz/git/mingw/j6t.git for-junio\n>\n> and the interdiff to the previous version is merely the reverse of\n> 31d6632. For your convenience I've merged it into current next:\n>\n> git://repo.or.cz/git/mingw/j6t.git merge-mingw-into-next\n\nThanks.  This round I am looking forward to very much being able to merge\nthis to 'next' for real, not just parking in 'pu', but it is getting late\nso it may have to wait til tomorrow.\n"}]}