Skip to content

Commit a24c44d

Browse files
authored
repo: Add/respect NO_VERIFY .env var (envoyproxy#22321)
Signed-off-by: Ryan Northey <[email protected]>
1 parent 452cb3a commit a24c44d

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

Diff for: support/README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,25 @@ This will set up the development support toolchain automatically. The toolchain
1616
uses git hooks extensively, copying them from `support/hooks` to the `.git`
1717
folder.
1818

19-
The commit hook checks can be skipped using the `-n` / `--no-verify` flags, as
19+
The commit hook checks can be skipped using the `--no-verify` flags, as
2020
so:
2121

2222
```bash
2323
git commit --no-verify
2424
```
2525

26+
You can also do this by adding `NO_VERIFY` to `.env`, for example:
27+
28+
```console
29+
$ echo NO_VERIFY=1 >> .env
30+
```
31+
32+
Or settting it in your environment:
33+
34+
```console
35+
$ export NO_VERIFY=1
36+
```
37+
2638
## Functionality
2739

2840
Currently the development support toolchain exposes two main pieces of

Diff for: support/bootstrap

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ fi
4747
HOOKS_DIR="${DOT_GIT_DIR}/hooks"
4848
HOOKS_DIR_RELPATH=$(relpath "${HOOKS_DIR}" "$(dirname "$0")")
4949

50-
if [ ! -e "${HOOKS_DIR}/prepare-commit-msg" ]; then
50+
if [[ -n "$REINSTALL_HOOKS" ]] || [[ ! -e "${HOOKS_DIR}/prepare-commit-msg" ]]; then
5151
echo "Installing hook 'prepare-commit-msg'"
5252
ln -sf "${HOOKS_DIR_RELPATH}/hooks/prepare-commit-msg" "${HOOKS_DIR}/prepare-commit-msg"
5353
fi
5454

55-
if [ ! -e "${HOOKS_DIR}/pre-push" ]; then
55+
if [[ -n "$REINSTALL_HOOKS" ]] || [[ ! -e "${HOOKS_DIR}/pre-push" ]]; then
5656
echo "Installing hook 'pre-push'"
5757
ln -sf "${HOOKS_DIR_RELPATH}/hooks/pre-push" "${HOOKS_DIR}/pre-push"
5858
fi

Diff for: support/hooks/pre-push

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@
99
#
1010
# $ ln -s ../../support/hooks/pre-push .git/hooks/pre-push
1111

12+
if [[ -e .env ]]; then
13+
# shellcheck disable=SC1091
14+
. .env
15+
fi
16+
17+
if [[ -n "$NO_VERIFY" ]]; then
18+
exit 0
19+
fi
20+
1221
DUMMY_SHA=0000000000000000000000000000000000000000
1322

14-
echo "Running pre-push check; to skip this step use 'push --no-verify'"
23+
# shellcheck disable=SC2016
24+
echo 'Running pre-push check; to skip this step use `push --no-verify` or add `NO_VERIFY=1` to `.env`'
25+
echo
1526
AUTHOR=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/\1/p')
1627

1728
# shellcheck disable=SC2034

0 commit comments

Comments
 (0)