File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ #
3+ # Hook script to validate rules and check locales before accepting
4+ # pushed changes on the server side.
5+ # See http://stackoverflow.com/questions/4541417/how-can-i-make-it-so-git-rejects-pushing-code-that-wont-compile
6+
7+ # --- Command line
8+ refname=" $1 "
9+ oldrev=" $2 "
10+ newrev=" $3 "
11+
12+ # --- Safety check
13+ if [ -z " $GIT_DIR " ]; then
14+ echo " Don't run this script from the command line." >&2
15+ echo " (if you want, you could supply GIT_DIR then run" >&2
16+ echo " $0 <ref> <oldrev> <newrev>)" >&2
17+ exit 1
18+ fi
19+
20+ if [ -z " $refname " -o -z " $oldrev " -o -z " $newrev " ]; then
21+ echo " Usage: $0 <ref> <oldrev> <newrev>" >&2
22+ exit 1
23+ fi
24+
25+ # --- Copy the state of the repository as of the new pushed code
26+
27+ copydir = " ./tmp/git_hook_compile_copy"
28+
29+ echo " making copy of $newrev to $copydir " >&2
30+ rm -rf " $copydir "
31+ mkdir " $copydir "
32+ git archive $newrev | tar -x -C $copydir /
33+ if [ " $? " != " 0" ]; then
34+ echo " *** unable to make copy of code" >&2
35+ exit 1
36+ fi
37+ echo " attempting to validate $newrev " >&2
38+
39+ # --- Test build
40+
41+ if [ -f makexpi.sh ]; then
42+ ./makexpi.sh
43+ if [ " $? " != 0 ]; then
44+ echo " *** build failed" >&2
45+ exit 1
46+ else
47+ exit 0
48+ fi
49+ else
50+ echo " *** could not find makexpi.sh" >&2
51+ exit 1
52+ fi
53+
You can’t perform that action at this time.
0 commit comments