aboutsummaryrefslogtreecommitdiffhomepage
path: root/spec/fixtures/test.git/git/hooks/pre-commit.sample
diff options
context:
space:
mode:
authorPaul Bonaud <paul.bonaud@fretlink.com>2019-04-13 16:38:04 +0200
committerPaul Bonaud <paul.bonaud@fretlink.com>2019-04-13 16:38:04 +0200
commit9c1df04756bd900c1ab61e98526ad6eaac8a7216 (patch)
treecf4048303525aa090d00d7a4a2977377cb6a99d1 /spec/fixtures/test.git/git/hooks/pre-commit.sample
parent83414e23d7f03a7a939655f51b81c0792fff616a (diff)
downloadpronto-hlint-9c1df04756bd900c1ab61e98526ad6eaac8a7216.tar.gz
pronto-hlint-9c1df04756bd900c1ab61e98526ad6eaac8a7216.tar.zst
pronto-hlint-9c1df04756bd900c1ab61e98526ad6eaac8a7216.zip
Welcom pronto-hlint! This is a whole rewrite of pronto-eslint_npm.
Forking the pronto-eslint_npm repository to build a runner for hlint haskell linter.
Diffstat (limited to 'spec/fixtures/test.git/git/hooks/pre-commit.sample')
-rwxr-xr-xspec/fixtures/test.git/git/hooks/pre-commit.sample49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/fixtures/test.git/git/hooks/pre-commit.sample b/spec/fixtures/test.git/git/hooks/pre-commit.sample
new file mode 100755
index 0000000..6a75641
--- /dev/null
+++ b/spec/fixtures/test.git/git/hooks/pre-commit.sample
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# An example hook script to verify what is about to be committed.
4# Called by "git commit" with no arguments. The hook should
5# exit with non-zero status after issuing an appropriate message if
6# it wants to stop the commit.
7#
8# To enable this hook, rename this file to "pre-commit".
9
10if git rev-parse --verify HEAD >/dev/null 2>&1
11then
12 against=HEAD
13else
14 # Initial commit: diff against an empty tree object
15 against=$(git hash-object -t tree /dev/null)
16fi
17
18# If you want to allow non-ASCII filenames set this variable to true.
19allownonascii=$(git config --bool hooks.allownonascii)
20
21# Redirect output to stderr.
22exec 1>&2
23
24# Cross platform projects tend to avoid non-ASCII filenames; prevent
25# them from being added to the repository. We exploit the fact that the
26# printable range starts at the space character and ends with tilde.
27if [ "$allownonascii" != "true" ] &&
28 # Note that the use of brackets around a tr range is ok here, (it's
29 # even required, for portability to Solaris 10's /usr/bin/tr), since
30 # the square bracket bytes happen to fall in the designated range.
31 test $(git diff --cached --name-only --diff-filter=A -z $against |
32 LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
33then
34 cat <<\EOF
35Error: Attempt to add a non-ASCII file name.
36
37This can cause problems if you want to work with people on other platforms.
38
39To be portable it is advisable to rename the file.
40
41If you know what you are doing you can disable this check using:
42
43 git config hooks.allownonascii true
44EOF
45 exit 1
46fi
47
48# If there are whitespace errors, print the offending file names and fail.
49exec git diff-index --check --cached $against --