Skip to content

Commit 948cf95

Browse files
committed
githook: pre-commit: create unique build dir
1 parent b919c2b commit 948cf95

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

.githooks/pre-commit

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# An example hook script to verify what is about to be committed.
44
# Called by "git commit" with no arguments. The hook should
@@ -18,8 +18,7 @@ fi
1818
# If you want to allow non-ASCII filenames set this variable to true.
1919
allownonascii=$(git config --type=bool hooks.allownonascii)
2020

21-
# Redirect output to stderr.
22-
exec 1>&2
21+
set -eo pipefail
2322

2423
# Cross platform projects tend to avoid non-ASCII filenames; prevent
2524
# them from being added to the repository. We exploit the fact that the
@@ -47,15 +46,9 @@ fi
4746

4847
# If there are whitespace errors, print the offending file names and fail.
4948
git diff-index --check --cached $against
50-
if [ "$?" -ne 0 ]
51-
then
52-
exit "$?"
53-
fi
5449

5550
# Configure and run the tests/examples
56-
cmake -B build
57-
if [ "$?" -ne 0 ]
58-
then
59-
exit "$?"
60-
fi
51+
cmake -B .build-githook
6152

53+
# Create the package
54+
cmake --build .build-githook --target package

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
build
2+
.build-githook

0 commit comments

Comments
 (0)