File tree Expand file tree Collapse file tree 3 files changed +1203
-1011
lines changed Expand file tree Collapse file tree 3 files changed +1203
-1011
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ if git-rev-parse --verify HEAD > /dev/null 2>&1
6
+ then
7
+ against=HEAD
8
+ else
9
+ # Initial commit: diff against an empty tree object
10
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
11
+ fi
12
+
13
+ function grep-check {
14
+ test=" $1 "
15
+ ignore=" $2 "
16
+ msg=" $3 "
17
+ if (git diff --cached | egrep -i " $test " | grep -v IGNORE:" $ignore " ); then
18
+ echo " Error: $msg (This message can be suppressed by adding the string IGNORE:$ignore to the same line.)"
19
+ exit 1
20
+ fi
21
+ }
22
+
23
+ function grep-check-case-sensitive {
24
+ test=" $1 "
25
+ ignore=" $2 "
26
+ msg=" $3 "
27
+ if (git diff --cached | egrep " $test " | grep -v IGNORE:" $ignore " ); then
28
+ echo " Error: $msg (This message can be suppressed by adding the string IGNORE:$ignore to the same line.)"
29
+ exit 1
30
+ fi
31
+ }
32
+
33
+ grep-check-case-sensitive \
34
+ NOCOMMIT ` # IGNORE:NOCOMMIT` \
35
+ NOCOMMIT ` # IGNORE:NOCOMMIT` \
36
+ " Found a line tagged with NOCOMMIT." # IGNORE:NOCOMMIT
37
+
38
+ cargo fmt --all -- --check
39
+ cargo build --all-targets
40
+ cargo test --release
41
+
42
+ # Check for trailing whitespace
43
+ exec git diff-index --check --cached $against --
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ mydir=" $( dirname " $( readlink -f " $0 " ) " ) "
4
+ ln -s ../../git-hooks/pre-commit " $mydir " /.git/hooks/pre-commit
You can’t perform that action at this time.
0 commit comments