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