Skip to content

Instantly share code, notes, and snippets.

@phihag
Created November 19, 2012 20:54
Show Gist options
  • 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 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