What changed, and why it matters
This commit simply deletes the project's optional Git hooks and the documentation and helper scripts that installed them. Git hooks are local developer convenience scripts that run on your own machine when you commit or merge code. Removing them does not change any shipped code, network behavior, or cryptographic logic, and it does not create a security vulnerability.
No security action required. Maintainers who previously used the hooks should rely on CI or configure their own local checks.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the githooks/ directory (pre-commit and post-merge bash hooks), the contrib/copy-githooks.sh installer, the justfile githooks-install/githooks-remove recipes, and the CONTRIBUTING.md section describing them. The pre-commit hook only checked for non-ASCII filenames and whitespace errors; the post-merge hook only warned when project hooks had changed. None of these files were part of the compiled rust-bitcoin library or any release artifact. The change is purely a cleanup of local development tooling.
Changed components
githooks/pre-commitgithooks/post-mergecontrib/copy-githooks.shjustfileCONTRIBUTING.mdInspect captured patch +0 / −131
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 97f6ad43..118303e9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -18,7 +18,6 @@ changes to this document in a pull request.
* [Building](#building)
- [Development Tools](#development-tools)
* [Just](#just)
- * [Githooks](#githooks)
* [Building the docs](#building-the-docs)
- [Contribution workflow](#contribution-workflow)
* [Preparing PRs](#preparing-prs)
@@ -116,11 +115,6 @@ detailed instructions.
We support [`just`](https://just.systems/man/en/) for running dev workflow commands. Run `just` from
your shell to see a list of available sub-commands.
-### Githooks
-
-To assist devs in catching errors _before_ running CI we provide some githooks. Copy the hooks in `githooks/`
-to your githooks folder or run `just githooks-install` to copy them all.
-
### Building the docs
We build docs with the nightly toolchain, you may wish to use the following shell alias to check
diff --git a/contrib/copy-githooks.sh b/contrib/copy-githooks.sh
deleted file mode 100755
index 13632db5..00000000
--- a/contrib/copy-githooks.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-GIT_DIR=$(git rev-parse --git-common-dir)
-HOOKS_DIR=$(git config --get core.hooksPath || echo "$GIT_DIR/hooks")
-
-remove_githooks() {
- for hook in githooks/*
- do
- bn=$(basename "$hook")
- echo "Removing githook $bn"
- rm "$HOOKS_DIR/$bn"
- done
- exit 0
-}
-
-add_githooks() {
- mkdir -p "$HOOKS_DIR"
- cp -i githooks/* "$HOOKS_DIR"
- exit 0
-}
-
-while getopts "r" flag; do
- case $flag in
- r) remove_githooks
- ;;
- *) exit 1
- ;;
- esac
-done
-
-add_githooks # Copy githooks by default (no options provided)
diff --git a/githooks/post-merge b/githooks/post-merge
deleted file mode 100755
index 2d78934d..00000000
--- a/githooks/post-merge
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env bash
-# === RUST-BITCOIN GITHOOK ===
-
-# Scan the githooks after merge. If the user is using any of the rust-bitcoin githooks and they have changed, let them know
-# to rerun the githooks setup.
-
-# We only care about this on master
-[[ "$(git branch --show-current)" = "master" ]] || exit
-
-# Get the local githooks directory, regardless of configuration.
-GIT_DIR=$(git rev-parse --git-common-dir)
-HOOKS_DIR=$(git config --get core.hooksPath || echo "$GIT_DIR/hooks")
-
-# Scan each of the hooks looking for the tag. If the tag is found, then the user is using a
-# rust-bitcoin githook. We should compare them to the repo's hooks to see if they have
-# changed in the latest git pull.
-for hook in "$HOOKS_DIR"/*
-do
- if grep -q '=== RUST-BITCOIN GITHOOK ===' "$hook"; then
- BN=$(basename "$hook")
- if ! cmp --quiet "$hook" "githooks/$BN"; then
- >&2 cat <<- EOF
- ==================================================
- Project githooks have changed. Please inspect the
- changes and re-run \`just githooks-install\` if
- they are legitimate.
-
- Remove $HOOKS_DIR/post-merge to skip this warning
- in the future.
- ==================================================
- EOF
- exit
- fi
- fi
-done
diff --git a/githooks/pre-commit b/githooks/pre-commit
deleted file mode 100755
index 99725d3a..00000000
--- a/githooks/pre-commit
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env bash
-# === RUST-BITCOIN GITHOOK ===
-#
-# Verify what is about to be committed. Called by "git commit" with no
-# arguments. The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit.
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=$(git hash-object -t tree /dev/null)
-fi
-
-# If you want to allow non-ASCII filenames set this variable to true.
-allownonascii=$(git config --bool hooks.allownonascii)
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ASCII filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test "$(git diff --cached --name-only --diff-filter=A -z "$against" |
- LC_ALL=C tr -d '[ -~]\0' | wc -c)" != 0
-then
- cat <<\EOF
-Error: Attempt to add a non-ASCII file name.
-
-This can cause problems if you want to work with people on other platforms.
-
-To be portable it is advisable to rename the file.
-
-If you know what you are doing you can disable this check using:
-
- git config hooks.allownonascii true
-EOF
- exit 1
-fi
-
-# If there are whitespace errors, print the offending file names and fail.
-git diff-index --check --cached "$against" -- || exit 1
diff --git a/justfile b/justfile
index 0be0f9c2..6a508dcb 100644
--- a/justfile
+++ b/justfile
@@ -31,16 +31,6 @@ check-api: (rbmt "api")
@query-api crate command:
{{justfile_directory()}}/contrib/api.sh $1 $2
-# Install githooks.
-[group('scripts')]
-githooks-install:
- {{justfile_directory()}}/contrib/copy-githooks.sh
-
-# Remove githooks.
-[group('scripts')]
-githooks-remove:
- {{justfile_directory()}}/contrib/copy-githooks.sh -r
-
# Generate a dependency tree for workspace crates.
[group('scripts')]
gen-dep-tree:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.