Version of easy-connect with the u-blox cellular platforms C027 and C030 added.

Dependents:   HelloMQTT

Committer:
RobMeades
Date:
Fri Nov 03 13:01:23 2017 +0000
Revision:
6:304d3ba87a01
Parent:
0:19aa55d66228
Add comment concerning N2XX baud rate.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-ublox 0:19aa55d66228 1 #!/bin/sh
group-ublox 0:19aa55d66228 2 #
group-ublox 0:19aa55d66228 3 # An example hook script to blocks unannotated tags from entering.
group-ublox 0:19aa55d66228 4 # Called by "git receive-pack" with arguments: refname sha1-old sha1-new
group-ublox 0:19aa55d66228 5 #
group-ublox 0:19aa55d66228 6 # To enable this hook, rename this file to "update".
group-ublox 0:19aa55d66228 7 #
group-ublox 0:19aa55d66228 8 # Config
group-ublox 0:19aa55d66228 9 # ------
group-ublox 0:19aa55d66228 10 # hooks.allowunannotated
group-ublox 0:19aa55d66228 11 # This boolean sets whether unannotated tags will be allowed into the
group-ublox 0:19aa55d66228 12 # repository. By default they won't be.
group-ublox 0:19aa55d66228 13 # hooks.allowdeletetag
group-ublox 0:19aa55d66228 14 # This boolean sets whether deleting tags will be allowed in the
group-ublox 0:19aa55d66228 15 # repository. By default they won't be.
group-ublox 0:19aa55d66228 16 # hooks.allowmodifytag
group-ublox 0:19aa55d66228 17 # This boolean sets whether a tag may be modified after creation. By default
group-ublox 0:19aa55d66228 18 # it won't be.
group-ublox 0:19aa55d66228 19 # hooks.allowdeletebranch
group-ublox 0:19aa55d66228 20 # This boolean sets whether deleting branches will be allowed in the
group-ublox 0:19aa55d66228 21 # repository. By default they won't be.
group-ublox 0:19aa55d66228 22 # hooks.denycreatebranch
group-ublox 0:19aa55d66228 23 # This boolean sets whether remotely creating branches will be denied
group-ublox 0:19aa55d66228 24 # in the repository. By default this is allowed.
group-ublox 0:19aa55d66228 25 #
group-ublox 0:19aa55d66228 26
group-ublox 0:19aa55d66228 27 # --- Command line
group-ublox 0:19aa55d66228 28 refname="$1"
group-ublox 0:19aa55d66228 29 oldrev="$2"
group-ublox 0:19aa55d66228 30 newrev="$3"
group-ublox 0:19aa55d66228 31
group-ublox 0:19aa55d66228 32 # --- Safety check
group-ublox 0:19aa55d66228 33 if [ -z "$GIT_DIR" ]; then
group-ublox 0:19aa55d66228 34 echo "Don't run this script from the command line." >&2
group-ublox 0:19aa55d66228 35 echo " (if you want, you could supply GIT_DIR then run" >&2
group-ublox 0:19aa55d66228 36 echo " $0 <ref> <oldrev> <newrev>)" >&2
group-ublox 0:19aa55d66228 37 exit 1
group-ublox 0:19aa55d66228 38 fi
group-ublox 0:19aa55d66228 39
group-ublox 0:19aa55d66228 40 if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
group-ublox 0:19aa55d66228 41 echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
group-ublox 0:19aa55d66228 42 exit 1
group-ublox 0:19aa55d66228 43 fi
group-ublox 0:19aa55d66228 44
group-ublox 0:19aa55d66228 45 # --- Config
group-ublox 0:19aa55d66228 46 allowunannotated=$(git config --bool hooks.allowunannotated)
group-ublox 0:19aa55d66228 47 allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
group-ublox 0:19aa55d66228 48 denycreatebranch=$(git config --bool hooks.denycreatebranch)
group-ublox 0:19aa55d66228 49 allowdeletetag=$(git config --bool hooks.allowdeletetag)
group-ublox 0:19aa55d66228 50 allowmodifytag=$(git config --bool hooks.allowmodifytag)
group-ublox 0:19aa55d66228 51
group-ublox 0:19aa55d66228 52 # check for no description
group-ublox 0:19aa55d66228 53 projectdesc=$(sed -e '1q' "$GIT_DIR/description")
group-ublox 0:19aa55d66228 54 case "$projectdesc" in
group-ublox 0:19aa55d66228 55 "Unnamed repository"* | "")
group-ublox 0:19aa55d66228 56 echo "*** Project description file hasn't been set" >&2
group-ublox 0:19aa55d66228 57 exit 1
group-ublox 0:19aa55d66228 58 ;;
group-ublox 0:19aa55d66228 59 esac
group-ublox 0:19aa55d66228 60
group-ublox 0:19aa55d66228 61 # --- Check types
group-ublox 0:19aa55d66228 62 # if $newrev is 0000...0000, it's a commit to delete a ref.
group-ublox 0:19aa55d66228 63 zero="0000000000000000000000000000000000000000"
group-ublox 0:19aa55d66228 64 if [ "$newrev" = "$zero" ]; then
group-ublox 0:19aa55d66228 65 newrev_type=delete
group-ublox 0:19aa55d66228 66 else
group-ublox 0:19aa55d66228 67 newrev_type=$(git cat-file -t $newrev)
group-ublox 0:19aa55d66228 68 fi
group-ublox 0:19aa55d66228 69
group-ublox 0:19aa55d66228 70 case "$refname","$newrev_type" in
group-ublox 0:19aa55d66228 71 refs/tags/*,commit)
group-ublox 0:19aa55d66228 72 # un-annotated tag
group-ublox 0:19aa55d66228 73 short_refname=${refname##refs/tags/}
group-ublox 0:19aa55d66228 74 if [ "$allowunannotated" != "true" ]; then
group-ublox 0:19aa55d66228 75 echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
group-ublox 0:19aa55d66228 76 echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
group-ublox 0:19aa55d66228 77 exit 1
group-ublox 0:19aa55d66228 78 fi
group-ublox 0:19aa55d66228 79 ;;
group-ublox 0:19aa55d66228 80 refs/tags/*,delete)
group-ublox 0:19aa55d66228 81 # delete tag
group-ublox 0:19aa55d66228 82 if [ "$allowdeletetag" != "true" ]; then
group-ublox 0:19aa55d66228 83 echo "*** Deleting a tag is not allowed in this repository" >&2
group-ublox 0:19aa55d66228 84 exit 1
group-ublox 0:19aa55d66228 85 fi
group-ublox 0:19aa55d66228 86 ;;
group-ublox 0:19aa55d66228 87 refs/tags/*,tag)
group-ublox 0:19aa55d66228 88 # annotated tag
group-ublox 0:19aa55d66228 89 if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
group-ublox 0:19aa55d66228 90 then
group-ublox 0:19aa55d66228 91 echo "*** Tag '$refname' already exists." >&2
group-ublox 0:19aa55d66228 92 echo "*** Modifying a tag is not allowed in this repository." >&2
group-ublox 0:19aa55d66228 93 exit 1
group-ublox 0:19aa55d66228 94 fi
group-ublox 0:19aa55d66228 95 ;;
group-ublox 0:19aa55d66228 96 refs/heads/*,commit)
group-ublox 0:19aa55d66228 97 # branch
group-ublox 0:19aa55d66228 98 if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
group-ublox 0:19aa55d66228 99 echo "*** Creating a branch is not allowed in this repository" >&2
group-ublox 0:19aa55d66228 100 exit 1
group-ublox 0:19aa55d66228 101 fi
group-ublox 0:19aa55d66228 102 ;;
group-ublox 0:19aa55d66228 103 refs/heads/*,delete)
group-ublox 0:19aa55d66228 104 # delete branch
group-ublox 0:19aa55d66228 105 if [ "$allowdeletebranch" != "true" ]; then
group-ublox 0:19aa55d66228 106 echo "*** Deleting a branch is not allowed in this repository" >&2
group-ublox 0:19aa55d66228 107 exit 1
group-ublox 0:19aa55d66228 108 fi
group-ublox 0:19aa55d66228 109 ;;
group-ublox 0:19aa55d66228 110 refs/remotes/*,commit)
group-ublox 0:19aa55d66228 111 # tracking branch
group-ublox 0:19aa55d66228 112 ;;
group-ublox 0:19aa55d66228 113 refs/remotes/*,delete)
group-ublox 0:19aa55d66228 114 # delete tracking branch
group-ublox 0:19aa55d66228 115 if [ "$allowdeletebranch" != "true" ]; then
group-ublox 0:19aa55d66228 116 echo "*** Deleting a tracking branch is not allowed in this repository" >&2
group-ublox 0:19aa55d66228 117 exit 1
group-ublox 0:19aa55d66228 118 fi
group-ublox 0:19aa55d66228 119 ;;
group-ublox 0:19aa55d66228 120 *)
group-ublox 0:19aa55d66228 121 # Anything else (is there anything else?)
group-ublox 0:19aa55d66228 122 echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
group-ublox 0:19aa55d66228 123 exit 1
group-ublox 0:19aa55d66228 124 ;;
group-ublox 0:19aa55d66228 125 esac
group-ublox 0:19aa55d66228 126
group-ublox 0:19aa55d66228 127 # --- Finished
group-ublox 0:19aa55d66228 128 exit 0