Skip to content

Commit

Permalink
chore(check): add a pre-push hook for easy install in other repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-boulle committed Aug 20, 2020
1 parent bc89086 commit 3ee2cf0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ Check all the commits between 2 references:

Behind the hood, the script use `git log` to list all the commit thus any syntax allowed by git will be working.

You can also use the pre-push commit validator, simply copy, `pre-push`, `validator.sh` and `check.sh` files
in `.git/hooks` directory of your repository.

<!-- ROADMAP -->

## Roadmap
Expand Down
28 changes: 28 additions & 0 deletions pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -e

remote="$1"
url="$2"

z40=0000000000000000000000000000000000000000

while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi

bash ./check.sh "$range"
fi
done

exit 0

0 comments on commit 3ee2cf0

Please sign in to comment.