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