Skip to content

Instantly share code, notes, and snippets.

@phihag
Created November 19, 2012 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phihag/4113818 to your computer and use it in GitHub Desktop.
Save phihag/4113818 to your computer and use it in GitHub Desktop.
#!/bin/sh
branch=$(echo "$1" | sed 's#refs/[^/]*/##')
repo="$GL_REPO/$branch"
mail_subject="$repo changed by $GL_USER"
oldcommit="$2"
if test "$2" = 0000000000000000000000000000000000000000; then
# New branch
oldcommit="$(git rev-parse --not --all | grep -v "$3" | git rev-list --stdin "$3" | tail -n 1)^"
fi
mail_text=$(git log "${oldcommit}..$3" --decorate --graph)
subscribers=$(git show $3:.subscribers 2>/dev/null)
for mail_to in $subscribers; do
echo "$mail_text" | mail -s "$mail_subject" -c '' "$mail_to" &
done
@phihag
Copy link
Author

phihag commented Nov 19, 2012

Install with

mkdir -p ~gitolite/local-code/VREF
wget https://raw.github.com/gist/4113818/f74b74beb74374cdd37be326194ef1a867ef3f5d/NOTIFY_EMAIL \
     -O ~gitolite/local-code/VREF/NOTIFY_EMAIL
chmod a+x ~gitolite/local-code/VREF/NOTIFY_EMAIL

and add

LOCAL_CODE =>  "$ENV{HOME}/local-code",

in ~gitolite/.gitolite.rc.

@phihag
Copy link
Author

phihag commented Nov 20, 2012

To activate, add

repo    @all
  -     VREF/NOTIFY_EMAIL          = @all

in the gitolite.conf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment