File: update

package info (click to toggle)
plplot 5.14.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,424 kB
  • sloc: ansic: 79,613; xml: 28,583; cpp: 20,037; ada: 19,456; tcl: 12,081; f90: 11,423; ml: 7,276; java: 6,863; python: 6,792; sh: 3,185; perl: 828; lisp: 75; makefile: 48; sed: 33; fortran: 5
file content (61 lines) | stat: -rwxr-xr-x 2,383 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh

# --- Command line
# Name of the ref being updated.
refname="$1"
# The old object name currently stored in the ref.
oldrev="$2"
# The new objectname to be stored in the ref.
newrev="$3"

# --- Safety check
if [ -z "$GIT_DIR" ]; then
    echo "Don't run this script from the command line." >&2
    echo " (if you want, you could supply GIT_DIR then run" >&2
    echo "  $0 <ref> <oldrev> <newrev>)" >&2
    exit 1
fi

if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
    echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
    exit 1
fi

if [ "$refname" = "refs/heads/master" ] ; then
    # Don't allow merge commits on master
    for rev in $(git rev-list $oldrev..$newrev) ; do
	# $rev is one of a list of commits found by the above
        # command that are in $newrev, but not $oldrev, i.e., the
        # new commits being applied to master.
	echo -n "Checking: commit $rev on master not a merge commit"
        # Is there a second parent?
        if git rev-parse --verify --quiet $rev^2 > /dev/null ; then
            echo "\n$rev is a merge commit found on the master branch which is not allowed by the rebase workflow of the PLplot project.  To avoid this reject of your push, please consult the documentation of the PLplot workflow in the file README.developers."
            exit 1
        else
            echo " (ok)"
        fi
    done
elif [ "${refname#*refs/tags/}" != "$refname" ] ; then
    # The above logic tests if "refs/tags/" is a substring of $refname
    # for posix-compliant shells like dash (which is normally what
    # bin/sh above refers to on Linux systems).

    # Don't allow tag deletes or reusing an old tagname to point to a
    # new commit ID.  These update hook ideas obtained from
    # http://stackoverflow.com/questions/6390966/disable-tag-deletion

    # exactly 40 zeros are required.
    zero_id=0000000000000000000000000000000000000000
    echo -n "Checking: $refname update with oldrev = $oldrev and newrev = $newrev"
    if [ "$newrev" = "$zero_id" ] ; then
	echo "\nThis is an attempt to delete a tag which is not allowed with PLplot"
	exit 1
    elif [ "$oldrev" != "$zero_id" ] ; then
        # Normally $oldrev is $zero_id unless it is a reuse attempt.
	echo "\nThis is an attempt to reuse an old tagname to point to a new commit ID which is not allowed with PLplot"
	exit 1
    else
        echo " (ok)"
    fi
fi