2009-08-09 14:56:23 +02:00
|
|
|
#!/bin/sh
|
2010-07-06 05:38:34 +02:00
|
|
|
# This script can be used to generate links in commit messages.
|
2009-08-09 14:56:23 +02:00
|
|
|
#
|
|
|
|
# To use this script, refer to this file with either the commit-filter or the
|
|
|
|
# repo.commit-filter options in cgitrc.
|
2011-03-23 11:57:44 +01:00
|
|
|
#
|
|
|
|
# The following environment variables can be used to retrieve the configuration
|
|
|
|
# of the repository for which this script is called:
|
|
|
|
# CGIT_REPO_URL ( = repo.url setting )
|
|
|
|
# CGIT_REPO_NAME ( = repo.name setting )
|
|
|
|
# CGIT_REPO_PATH ( = repo.path setting )
|
|
|
|
# CGIT_REPO_OWNER ( = repo.owner setting )
|
|
|
|
# CGIT_REPO_DEFBRANCH ( = repo.defbranch setting )
|
|
|
|
# CGIT_REPO_SECTION ( = section setting )
|
|
|
|
# CGIT_REPO_CLONE_URL ( = repo.clone-url setting )
|
|
|
|
#
|
2009-08-09 14:56:23 +02:00
|
|
|
|
2011-07-18 12:45:20 +02:00
|
|
|
regex=''
|
|
|
|
|
2010-07-06 05:38:34 +02:00
|
|
|
# This expression generates links to commits referenced by their SHA1.
|
|
|
|
regex=$regex'
|
2011-07-18 12:45:20 +02:00
|
|
|
s|\b([0-9a-fA-F]{7,40})\b|<a href="./?id=\1">\1</a>|g'
|
|
|
|
|
2010-07-06 05:38:34 +02:00
|
|
|
# This expression generates links to a fictional bugtracker.
|
|
|
|
regex=$regex'
|
2011-07-18 12:45:20 +02:00
|
|
|
s|#([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g'
|
2010-07-06 05:38:34 +02:00
|
|
|
|
|
|
|
sed -re "$regex"
|