Skip to content

Commit 1683d56

Browse files
committed
Add pre-commit hook
1 parent 3300163 commit 1683d56

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.githooks/pre-commit

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
if ! cargo xtask gen-man
6+
then
7+
echo "Task 'gen-man' failed"
8+
exit 1
9+
fi
10+
11+
if ! cargo xtask gen-comp
12+
then
13+
echo "Task 'gen-comp' failed"
14+
exit 1
15+
fi
16+
17+
if ! git diff --quiet extra/completions
18+
then
19+
echo "Shell completions changed, please add the changes via \"git add extra/completions/*\""
20+
exit 1
21+
fi
22+
23+
if ! git diff --quiet extra/man
24+
then
25+
echo "Man pages changed, please add the changes via \"git add extra/man/*\""
26+
exit 1
27+
fi
28+
29+
exit 0

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,16 @@ This repository contains the Stackable library, the Stackable CLI tool, and the
99
- `stackabled`: API server used by frontends to interact with the data platform. [Link][daemon-readme]
1010

1111
[daemon-readme]: ./bins/stackd/README.md
12-
[ctl-readme]: ./bins/stackctl/README.md
12+
[ctl-readme]: ./bins/stackctl/README.md
13+
14+
## Developer Setup
15+
16+
This repository ships custom Git hooks. They are located in the `.githooks` directory. Before you enable them, make sure
17+
to check out the code they execute. Currently, the `pre-commit` hook runs two tasks: `gen-man` and `gen-comp`. See
18+
[here][xtasks] what these tasks do. To enable all hooks inside the directory, use the following command:
19+
20+
```shell
21+
git config --local core.hooksPath .githooks/
22+
```
23+
24+
[xtasks][./xtask/src/main.rs]

0 commit comments

Comments
 (0)