fa24711e |
1 | #! /usr/bin/env bash |
2 | # tl;dr AGPLv3+ |
3 | # copyright info at bottom |
4 | |
5 | set -o nounset |
6 | set -o errexit |
7 | |
8 | GILT_HOOKUP_DEBUG="${GILT_HOOKUP_DEBUG:-}" |
9 | |
10 | if (( GILT_HOOKUP_DEBUG )); then |
11 | set -x |
12 | echo "in $0" |
13 | pwd |
14 | fi |
15 | |
16 | # create a temp directory to hold just the staged content |
17 | # mktemp is used twice here, the first works on gnu, |
18 | # the second works on mac |
19 | stage_dir=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'` |
20 | |
21 | # remove the temp staging directory when sigterm, sigint (ctrl-c), |
22 | # and when the script exits normally |
23 | # the exit status of the script will not be affected by this trap |
24 | # when it traps the SIGEXIT signal |
25 | # if we're debugging, then leave the testing directory around |
26 | # for inspection |
27 | if (( ! GILT_HOOKUP_DEBUG )); then |
28 | trap 'rm -rf "$stage_dir"' SIGTERM SIGINT EXIT |
29 | fi |
30 | |
31 | # checkout all staged files into temporary staging directory |
32 | git checkout-index --prefix="${stage_dir}/" --all \ |
33 | && sync |
34 | |
35 | if (( GILT_HOOKUP_DEBUG )); then |
36 | tree "$stage_dir" |
37 | fi |
38 | |
39 | # run make in temporary staging directory |
40 | make --directory="$stage_dir" |
41 | |
42 | # flibbertigibbet is a lein new flibbertigibbet project-name |
43 | # Copyright (C) 2016 daniel watson |
44 | |
45 | # This file is part of flibbertigibbet. |
46 | |
47 | # flibbertigibbet is free software: you can redistribute it and/or |
48 | # modify it under the terms of the GNU Affero General Public License as |
49 | # published by the Free Software Foundation, either version 3 of the |
50 | # License, or (at your option) any later version. |
51 | |
52 | # flibbertigibbet is distributed in the hope that it |
53 | # will be useful, but WITHOUT ANY WARRANTY; without even the implied |
54 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
55 | # the GNU General Affero Public License for more details. |
56 | |
57 | # You should have received a copy of the GNU Affero General Public License |
58 | # along with flibbertigibbet. If not, see |
59 | # <http://www.gnu.org/licenses/>. |