2009-08-09 12:56:23 +00:00
|
|
|
#!/bin/sh
|
2010-07-06 03:38:34 +00:00
|
|
|
# This script can be used to generate links in commit messages.
|
2009-08-09 12:56:23 +00: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 10:57:44 +00: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 12:56:23 +00:00
|
|
|
|
2010-07-06 03:38:34 +00:00
|
|
|
# This expression generates links to commits referenced by their SHA1.
|
|
|
|
regex=$regex'
|
|
|
|
s|\b([0-9a-fA-F]{8,40})\b|<a href="./?id=\1">\1</a>|g'
|
|
|
|
# This expression generates links to a fictional bugtracker.
|
|
|
|
regex=$regex'
|
|
|
|
s| #([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g'
|
|
|
|
|
|
|
|
sed -re "$regex"
|