File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 14
14
# Information about the commits which are being pushed is supplied as lines to
15
15
# the standard input in the form:
16
16
#
17
- # <local ref> <local sha1 > <remote ref> <remote sha1 >
17
+ # <local ref> <local oid > <remote ref> <remote oid >
18
18
#
19
19
# This sample shows how to prevent push of commits where the log message starts
20
20
# with "WIP" (work in progress).
21
21
22
22
remote=" $1 "
23
23
url=" $2 "
24
24
25
- z40=0000000000000000000000000000000000000000
25
+ zero= $( git hash-object --stdin < /dev/null | tr ' [0-9a-f] ' ' 0 ' )
26
26
27
- while read local_ref local_sha remote_ref remote_sha
27
+ while read local_ref local_oid remote_ref remote_oid
28
28
do
29
- if [ " $local_sha " = $z40 ]
29
+ if test " $local_oid " = " $zero "
30
30
then
31
31
# Handle delete
32
32
:
33
33
else
34
- if [ " $remote_sha " = $z40 ]
34
+ if test " $remote_oid " = " $zero "
35
35
then
36
36
# New branch, examine all commits
37
- range=" $local_sha "
37
+ range=" $local_oid "
38
38
else
39
39
# Update to existing branch, examine new commits
40
- range=" $remote_sha ..$local_sha "
40
+ range=" $remote_oid ..$local_oid "
41
41
fi
42
42
43
43
# Check for WIP commit
44
- commit=` git rev-list -n 1 --grep ' ^WIP' " $range " `
45
- if [ -n " $commit " ]
44
+ commit=$( git rev-list -n 1 --grep ' ^WIP' " $range " )
45
+ if test -n " $commit "
46
46
then
47
47
echo >&2 " Found WIP commit in $local_ref , not pushing"
48
48
exit 1
Original file line number Diff line number Diff line change 60
60
61
61
# --- Check types
62
62
# if $newrev is 0000...0000, it's a commit to delete a ref.
63
- zero=" 0000000000000000000000000000000000000000 "
63
+ zero=$( git hash-object --stdin < /dev/null | tr ' [0-9a-f] ' ' 0 ' )
64
64
if [ " $newrev " = " $zero " ]; then
65
65
newrev_type=delete
66
66
else
You can’t perform that action at this time.
0 commit comments