this is testing

Committer:
pmallick
Date:
Thu Jan 14 19:12:57 2021 +0530
Revision:
0:e8a1ba50c46b
this is testing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pmallick 0:e8a1ba50c46b 1 #!/bin/sh
pmallick 0:e8a1ba50c46b 2
pmallick 0:e8a1ba50c46b 3 # An example hook script to verify what is about to be pushed. Called by "git
pmallick 0:e8a1ba50c46b 4 # push" after it has checked the remote status, but before anything has been
pmallick 0:e8a1ba50c46b 5 # pushed. If this script exits with a non-zero status nothing will be pushed.
pmallick 0:e8a1ba50c46b 6 #
pmallick 0:e8a1ba50c46b 7 # This hook is called with the following parameters:
pmallick 0:e8a1ba50c46b 8 #
pmallick 0:e8a1ba50c46b 9 # $1 -- Name of the remote to which the push is being done
pmallick 0:e8a1ba50c46b 10 # $2 -- URL to which the push is being done
pmallick 0:e8a1ba50c46b 11 #
pmallick 0:e8a1ba50c46b 12 # If pushing without using a named remote those arguments will be equal.
pmallick 0:e8a1ba50c46b 13 #
pmallick 0:e8a1ba50c46b 14 # Information about the commits which are being pushed is supplied as lines to
pmallick 0:e8a1ba50c46b 15 # the standard input in the form:
pmallick 0:e8a1ba50c46b 16 #
pmallick 0:e8a1ba50c46b 17 # <local ref> <local sha1> <remote ref> <remote sha1>
pmallick 0:e8a1ba50c46b 18 #
pmallick 0:e8a1ba50c46b 19 # This sample shows how to prevent push of commits where the log message starts
pmallick 0:e8a1ba50c46b 20 # with "WIP" (work in progress).
pmallick 0:e8a1ba50c46b 21
pmallick 0:e8a1ba50c46b 22 remote="$1"
pmallick 0:e8a1ba50c46b 23 url="$2"
pmallick 0:e8a1ba50c46b 24
pmallick 0:e8a1ba50c46b 25 z40=0000000000000000000000000000000000000000
pmallick 0:e8a1ba50c46b 26
pmallick 0:e8a1ba50c46b 27 while read local_ref local_sha remote_ref remote_sha
pmallick 0:e8a1ba50c46b 28 do
pmallick 0:e8a1ba50c46b 29 if [ "$local_sha" = $z40 ]
pmallick 0:e8a1ba50c46b 30 then
pmallick 0:e8a1ba50c46b 31 # Handle delete
pmallick 0:e8a1ba50c46b 32 :
pmallick 0:e8a1ba50c46b 33 else
pmallick 0:e8a1ba50c46b 34 if [ "$remote_sha" = $z40 ]
pmallick 0:e8a1ba50c46b 35 then
pmallick 0:e8a1ba50c46b 36 # New branch, examine all commits
pmallick 0:e8a1ba50c46b 37 range="$local_sha"
pmallick 0:e8a1ba50c46b 38 else
pmallick 0:e8a1ba50c46b 39 # Update to existing branch, examine new commits
pmallick 0:e8a1ba50c46b 40 range="$remote_sha..$local_sha"
pmallick 0:e8a1ba50c46b 41 fi
pmallick 0:e8a1ba50c46b 42
pmallick 0:e8a1ba50c46b 43 # Check for WIP commit
pmallick 0:e8a1ba50c46b 44 commit=`git rev-list -n 1 --grep '^WIP' "$range"`
pmallick 0:e8a1ba50c46b 45 if [ -n "$commit" ]
pmallick 0:e8a1ba50c46b 46 then
pmallick 0:e8a1ba50c46b 47 echo >&2 "Found WIP commit in $local_ref, not pushing"
pmallick 0:e8a1ba50c46b 48 exit 1
pmallick 0:e8a1ba50c46b 49 fi
pmallick 0:e8a1ba50c46b 50 fi
pmallick 0:e8a1ba50c46b 51 done
pmallick 0:e8a1ba50c46b 52
pmallick 0:e8a1ba50c46b 53 exit 0