summaryrefslogtreecommitdiff
path: root/templates/hooks--pre-commit.sample
AgeCommit message (Collapse)Author
2011-10-26make the sample pre-commit hook script reject names with newlines, tooJim Meyering
The sample pre-commit hook script would fail to reject a file name like "a\nb" because of the way newlines are handled in "$(...)". Adjust the test to count filtered bytes and require there be 0. Also print all diagnostics to standard error, not stdout, so they will actually be seen. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-20Modernize git calling conventions in hook templatesBen Walton
The hook templates were still using/referencing 'git-foo' instead of 'git foo.' This patch updates the sample hooks to use the modern conventions instead. Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-07pre-commit.sample: Diff against the empty tree when HEAD is invalidBjörn Steinbrink
This was already the case for the old "diff --check" call, but the new one that checks whether there are any non-ascii file names was missing it, making that check fail for root commits. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-22pre-commit.sample: add comment re tr portability; fix grammarJim Meyering
Add a comment explaining why square brackets around a tr range are not only ok, but actually required in this case. Correct spelling and grammar. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-20Extend sample pre-commit hook to check for non ascii filenamesHeiko Voigt
At the moment non-ascii encodings of filenames are not portably converted between different filesystems by git. This will most likely change in the future but to allow repositories to be portable among different file/operating systems this check is enabled by default. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-16pre-commit.sample: don't print incidental SHA1Jim Meyering
Make the sample pre-commit hook script discard all git-rev-parse output, not just stderr. Otherwise, it would print an SHA1. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-27Update sample pre-commit hook to use "diff --check"Junio C Hamano
Now "diff --check" can detect not just whitespace errors but also notices leftover conflict marker lines, we can use it in the sample pre-commit hook script. These days the object layer knows about the empty tree object without actually having one in the repository, so we can run the test even for the initial commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-25Ship sample hooks with .sample suffixJunio C Hamano
We used to mark hooks we ship as samples by making them unexecutable, but some filesystems cannot tell what is executable and what is not. This makes it much more explicit. The hooks are suffixed with .sample (but now are made executable), so enabling it is still one step operation (instead of "chmod +x $hook", you would do "mv $hook.sample $hook") but now they won't get accidentally enabled on systems without executable bit. Signed-off-by: Junio C Hamano <gitster@pobox.com>