To close tickets by commit add the following lines to a commit message:
BUG:xxx FIXED-IN:yyy
/home/git/p/ktoblzcheck/code.git/hooks/post-receive
# The following line is required for site integration, do not remove/modify curl -s http://sourceforge.net/auth/refresh_repo/p/ktoblzcheck/code/ DIR="$(dirname "${BASH_SOURCE[0]}")" if [ -x $DIR/post-receive-user ]; then exec $DIR/post-receive-user fi
/home/git/p/ktoblzcheck/code.git/hooks/post-receive-user
1 2 3 4 5 6 7 8 9 10 | #!/bin/bash DIR="$(dirname "${BASH_SOURCE[0]}")" while read oldrev newrev refname do # email notifications, see https://sourceforge.net/p/forge/documentation/Git/#server-hooks echo $oldrev $newrev $refname | exec /usr/share/git-core/contrib/hooks/post-receive-email # close tickets echo $oldrev $newrev $refname | exec $DIR/post-receive-sf-ticket-close done |
/home/git/p/ktoblzcheck/code.git/hooks/post-receive-sf-ticket-close
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/bin/sh # # post-receive-sf-ticket-close # # @author Ralf Habacker <ralf.habacker@freenet.de> # access_token=xxx project=ktoblzcheck curl="curl" while read oldrev newrev refname do git --git-dir=$GIT_DIR log --oneline $oldrev..$newrev | sed 's, .*$,,g' | while read rev do git --git-dir=$GIT_DIR show "$rev" | while read -r line do case "$line" in *BUG:*) bug=${line#BUG:} ;; *FIXED-IN:*) version=${line#FIXED-IN:} ;; *diff*) if test -n "$bug"; then echo "closing bug '$bug'" post_data="access_token=$access_token&ticket_form.status=closed" if test -n "$version"; then post_data+="&ticket_form.labels=$version" fi $curl -s -H "Content-Type: application/x-www-form-urlencoded" \ -X POST \ -d "$post_data" \ -o /dev/null \ "https://sourceforge.net/rest/p/$project/bugs/$bug/save" fi ;; esac done done done |