File: git-pre-push-hook

package info (click to toggle)
bro-aux 0.42-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 1,104 kB
  • sloc: sh: 999; ansic: 943; ruby: 71; makefile: 68; perl: 35; cpp: 26
file content (31 lines) | stat: -rwxr-xr-x 835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
#
# A pre-push hook that makes sure all testing/external changes
# have been pushed already. If not, it will abort. Note that
# it will only check for unpushed commits, not for uncommited
# changes.
#
# To install this, copy it into you Bro tree's .git/hooks/pre-push.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If this script exits with a non-zero status nothing will be pushed.

test -d testing/external || exit 0

cd testing/external

base=`pwd`
abort=0

for repo in `./scripts/find-git-repos`; do
    cd ${base}/${repo} && \
        git rev-list @{u}.. | grep -q . && \
        echo "ERROR: testing/external/`basename $repo` has commits that are not pushed." && \
        abort=1
done

exit ${abort}