|
Last change
on this file was
3038,
checked in by gdb, 15 years ago
|
|
Added git hooks to invirt-dev package
|
-
Property svn:executable set to
*
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | #!/bin/sh |
|---|
| 2 | # |
|---|
| 3 | # This script is run after receive-pack has accepted a pack and the |
|---|
| 4 | # repository has been updated. It is passed arguments in through stdin |
|---|
| 5 | # in the form |
|---|
| 6 | # <oldrev> <newrev> <refname> |
|---|
| 7 | # For example: |
|---|
| 8 | # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master |
|---|
| 9 | |
|---|
| 10 | base=build.hooks.post_commit.zephyr |
|---|
| 11 | |
|---|
| 12 | class=$(invirt-getconf "$base.class" 2>/dev/null) |
|---|
| 13 | instance=$(invirt-getconf "$base.instance" 2>/dev/null) |
|---|
| 14 | zsig=$(invirt-getconf "$base.zsig" 2>/dev/null) |
|---|
| 15 | color=$(invirt-getconf "$base.color" 2>/dev/null) |
|---|
| 16 | |
|---|
| 17 | if [ "${color:-true}" = "true" ]; then |
|---|
| 18 | usecolor="--color" |
|---|
| 19 | else |
|---|
| 20 | usecolor="" |
|---|
| 21 | fi |
|---|
| 22 | |
|---|
| 23 | if [ -z "$class" ]; then |
|---|
| 24 | echo "I don't know where to send a commit zephyr!" >&2 |
|---|
| 25 | echo "Please provide a value for $base.class in" >&2 |
|---|
| 26 | echo "your invirt config file." >&2 |
|---|
| 27 | exit 1 |
|---|
| 28 | fi |
|---|
| 29 | while read oldrev newrev refname; do |
|---|
| 30 | if [ "$oldrev" = "0000000000000000000000000000000000000000" ]; then |
|---|
| 31 | # dammit git |
|---|
| 32 | zwrite -c "$class" -i "$(basename "$refname")" -s "${zsig:-Git}: $refname" -d \ |
|---|
| 33 | -m "New branch created." |
|---|
| 34 | continue |
|---|
| 35 | fi |
|---|
| 36 | git rev-list --first-parent --reverse "$oldrev..$newrev" | while read rev; do |
|---|
| 37 | shortrev=`git log -1 --pretty=format:%h "$rev"` |
|---|
| 38 | (git show --stat -M $usecolor "$rev" | |
|---|
| 39 | sed -e 's/@/@@/g' \ |
|---|
| 40 | -e 's/}/@(})/g' \ |
|---|
| 41 | -e 's/\[m/}@{/g' \ |
|---|
| 42 | -e 's/\[33m/@color(yellow)/g' \ |
|---|
| 43 | -e 's/\[31m/@color(red)/g' \ |
|---|
| 44 | -e 's/\[32m/@color(green)/g' \ |
|---|
| 45 | -e '1s/^/@{/' \ |
|---|
| 46 | -e '$s/$/}/') | |
|---|
| 47 | zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d |
|---|
| 48 | done |
|---|
| 49 | done |
|---|
Note: See
TracBrowser
for help on using the repository browser.