source: timingandestimationplugin/branches/trac1.0-Permissions/scripts/git-post-receive

Last change on this file was 4245, checked in by Russ Tyndall, 15 years ago

Added a copy of my git-post-receive incase others are interested this interacts with the trac-post-commit hook

File size: 1.2 KB
Line 
1#!/bin/sh
2#
3# An example hook script for the post-receive event
4#
5# This script is run after receive-pack has accepted a pack and the
6# repository has been updated.  It is passed arguments in through stdin
7# in the form
8#  <oldrev> <newrev> <refname>
9# For example:
10#  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11#
12# see contrib/hooks/ for an sample, or uncomment the next line (on debian)
13#
14
15
16TRAC_ENV="YOUR TRAC ENV HERE"
17LOG="/dev/null"
18echo "in git post commit: $TRAC_ENV" | cat >>$LOG
19
20while read oval nval ref ; do
21    if expr "$oval" : '0*$' >/dev/null
22    then
23        git-rev-list "$nval"
24    else
25        git-rev-list "$nval" "^$oval"
26    fi | while read com ; do
27    echo "posting a comment to trac" | cat >>$LOG
28    /usr/bin/python /usr/share/trac/contrib/trac-post-commit.py \
29        -p "$TRAC_ENV" \
30        -r "$com" \
31        -u "$(git-rev-list -n 1 $com --pretty=format:%an | sed '1d')" \
32        -m  "$(git-rev-list -n 1 $com --pretty=medium | sed '1,3d;s:^    ::')"
33    echo "DONE posting a comment to trac" | cat >>$LOG
34    done
35done
36
37echo "Done with trac commit hook: $TRAC_ENV" | cat >>$LOG
38
39git reset --hard
40echo "resetting repo working copy" | cat >>$LOG
Note: See TracBrowser for help on using the repository browser.