File: pre-push

package info (click to toggle)
bolt 0.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,812 kB
  • sloc: ansic: 28,978; python: 2,814; xml: 460; javascript: 269; sh: 180; makefile: 12
file content (32 lines) | stat: -rwxr-xr-x 675 bytes parent folder | download | duplicates (4)
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
32
#!/bin/sh
# Based on ".git/hooks/pre-push.sample"

remote="$1"
url="$2" # unused

z40=0000000000000000000000000000000000000000

while read local_ref local_sha remote_ref remote_sha
do
    if [ "$local_sha" = $z40 ]; then
        # ignore deletes
        continue
    fi

    if [ "$remote_sha" = $z40 ]; then
        # new branch, examine new commits starting $remote
        remote_sha=$(git rev-parse "$remote")
    fi

    range="$remote_sha..$local_sha"

    # check for fixup! commit
    commit=`git rev-list -n 1 --grep '^fixup! ' "$range"`
    if [ -n "$commit" ]; then
        echo >&2 "'fixup!' commit in $local_ref, not pushing"
        exit 1
    fi

done

exit 0