X-Git-Url: https://git.madduck.net/code/fbi-announce.git/blobdiff_plain/7c4edae57a5b24d39cf106a5f9ec66b8d2a6a7f7..6d3d31d7c6c7935b900267ef45514987aff6e6ef:/fbi-announce.sh diff --git a/fbi-announce.sh b/fbi-announce.sh index 76b3581..577dead 100755 --- a/fbi-announce.sh +++ b/fbi-announce.sh @@ -17,25 +17,14 @@ # hooks.fbi-component an optional component name # hooks.fbi-url-template the template to the gitweb URL (containing @@sha1@@) # hooks.fbi-emailsender the sender address to use in the email +# hooks.fbi-emailcc carbon-copy recipients (comma-separated) if the message # hooks.fbi-refwidth the width of references to show (default 7) # hooks.fbi-noisy include the entire log message in the announcement # hooks.fbi-msg-template the template for the message to be sent (default: # [@@component@@/]@@project@@: @@author@@: \ # @@logmessage@@ [@@ref@@] @@url@@) # -# The hook is meant ot be run either from a post-commit hook or an update hook. If run in -# a central repository where people push to you want to run it in the update hook! -# -# post-commit: It parses latest commit and current HEAD to get the information it needs. -# -# update: You have to call it once per merged commit: -# -# refname=$1 -# oldhead=$2 -# newhead=$3 -# for merged in $(git rev-list ${oldhead}..${newhead} | tac) ; do -# /path/to/ciabot.bash ${refname} ${merged} -# done +# The hook is meant ot be run from the Git post-receive hook. # set -eu @@ -56,6 +45,7 @@ url=$(git config hooks.fbi-url-template 2>/dev/null ||:) noisy=$(git config hooks.fbi-noisy 2>/dev/null || echo false) from=$(git config hooks.fbi-emailsender 2>/dev/null ||:) to="commit@commit.ganneff.de" #TODO: possibly factor out to config +cc=$(git config hooks.fbi-emailcc 2>/dev/null ||:) # mail submission client to use if [ -n "${FBI_ANNOUNCE_TO_STDOUT:-}" ]; then @@ -81,7 +71,7 @@ url=$(echo "$url" | sed -e "s,@@sha1@@,${merged},") rawcommit=$(git cat-file commit ${merged}) author=$(echo "${rawcommit}" | sed -rne 's,^author (.+) <.*,\1,p') -logmessage=$(echo "${rawcommit}" | sed -e '1,/^$/d;s,&,\&,g;s,<,\<,g;s,>,\>,g') +logmessage=$(echo "${rawcommit}" | sed -e '1,/^$/d') ${noisy} || logmessage=$(echo "${logmessage}" | head -n2) ts=$(echo "${rawcommit}" | sed -n -e '/^author .*> \([0-9]\+\).*$/s--\1-p') @@ -98,8 +88,10 @@ fi ${sendmail} <<_eom ${from:+From: ${from} }To: ${to} -Subject: Announce ${project} -Message-Id: +${cc:+Cc: ${cc} +}Subject: Announce ${project} +Message-Id: +Content-type: text/plain; charset=utf-8 ${msg} _eom