forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjustments to usage of
pre-commit
(digital-asset#15889)
- sets the default value for the hook type to `pre-push` - allows to configure the hook type using `DADE_PRE_COMMIT_HOOK_TYPE` - uninstalls all hooks with `direnv` before installation (no manual clean-up needed) - documents the usage of `pre-commit` in `README.md` - makes sure `pre-commit` is quiet when run with `direnv`
- Loading branch information
1 parent
9de4c8e
commit 06e5c65
Showing
2 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
echo "[dev-env] Setting up DA Development Environment" | ||
eval "$(dev-env/bin/dade assist)" | ||
|
||
DADE_PRE_COMMIT_HOOK_TYPE=pre-push | ||
|
||
# Load private overrides | ||
[[ -f .envrc.private ]] && source_env .envrc.private | ||
|
||
# install pre-commit hook (opt-out by setting `DADE_NO_PRE_COMMIT`) | ||
test "x$DADE_NO_PRE_COMMIT" = x && pre-commit install | ||
# always start from a clean slate to ensure that the install phase produces the scenario described by `DADE_NO_PRE_COMMIT` and `DADE_PRE_COMMIT_HOOK_TYPE` | ||
# this is a bit unfortunate but it doesn't look like pre-commit currently supports uninstalling all hooks in one go as of version 2.20.0 | ||
HOOK_TYPES=(pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit post-merge post-rewrite) | ||
for HOOK_TYPE in ${HOOK_TYPES[@]}; do pre-commit uninstall -t "$HOOK_TYPE" > /dev/null; done | ||
|
||
# install pre-commit hook (opt-out by setting `DADE_NO_PRE_COMMIT`, set the hook type with `DADE_PRE_COMMIT_HOOK_TYPE` -- defaults to 'pre-push') | ||
test "x$DADE_NO_PRE_COMMIT" = x && pre-commit install -t "$DADE_PRE_COMMIT_HOOK_TYPE" > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters