Add commit-filter for cgit

A commit-filter adds the ability to format commit messages.

This commit-filter automatically adds links for:
- Change-id: Link to the change on review.o.o
- SHA1 hash: Link to the git commit on git.o.o
- Bug: Link to the bug on launchpad.net
- Blueprint: Link to the blueprint on launchpad.net

Change-Id: If8916948ca154e6957efb005d35812ae097721b7
This commit is contained in:
Mathieu Gagné 2013-08-21 21:30:54 -04:00
parent f5189f7fcc
commit 6bd2888255
3 changed files with 18 additions and 0 deletions

View File

@ -17,6 +17,9 @@ cache-root-ttl=1
# Specify some default clone prefixes # Specify some default clone prefixes
clone-prefix=git://git.openstack.org https://git.openstack.org clone-prefix=git://git.openstack.org https://git.openstack.org
# Specify a command which will be invoked to format commit messages
commit-filter=/usr/local/bin/commit-filter.sh
# Specify the css url # Specify the css url
css=/static/openstack.css css=/static/openstack.css

View File

@ -0,0 +1,8 @@
#!/bin/sh
sed -re '
s`(I[0-9a-f]{8,40})`<a href="https://review.openstack.org/\#q,\1,n,z">\0</a>`g
s`\b([0-9a-fA-F]{8,40})\b`<a href="./?id=\1">\0</a>`g
s`(\b[Bb]ug\b|\b[Ll][Pp]\b)[ \t#:]*([0-9]+)`<a href="https://code.launchpad.net/bugs/\2">\0</a>`g
s`(\b[Bb]lue[Pp]rint\b|\b[Bb][Pp]\b)[ \t#:]*([A-Za-z0-9\.-]+)`<a href="https://blueprints.launchpad.net/openstack/?searchtext=\2">\0</a>`g
'

View File

@ -127,4 +127,11 @@ class openstack_project::git_backend (
require => File['/var/www/cgit/static'], require => File['/var/www/cgit/static'],
} }
file { '/usr/local/bin/commit-filter.sh':
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/openstack_project/git/commit-filter.sh',
}
} }