From 6bd28882555adaa30981a4a5b8d56b5cd1b220ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= Date: Wed, 21 Aug 2013 21:30:54 -0400 Subject: [PATCH] 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 --- modules/openstack_project/files/git/cgitrc | 3 +++ modules/openstack_project/files/git/commit-filter.sh | 8 ++++++++ modules/openstack_project/manifests/git_backend.pp | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 modules/openstack_project/files/git/commit-filter.sh diff --git a/modules/openstack_project/files/git/cgitrc b/modules/openstack_project/files/git/cgitrc index a8d7bb63e5..3ebc7e0791 100644 --- a/modules/openstack_project/files/git/cgitrc +++ b/modules/openstack_project/files/git/cgitrc @@ -17,6 +17,9 @@ cache-root-ttl=1 # Specify some default clone prefixes 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 css=/static/openstack.css diff --git a/modules/openstack_project/files/git/commit-filter.sh b/modules/openstack_project/files/git/commit-filter.sh new file mode 100644 index 0000000000..d780d6738a --- /dev/null +++ b/modules/openstack_project/files/git/commit-filter.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +sed -re ' +s`(I[0-9a-f]{8,40})`\0`g +s`\b([0-9a-fA-F]{8,40})\b`\0`g +s`(\b[Bb]ug\b|\b[Ll][Pp]\b)[ \t#:]*([0-9]+)`\0`g +s`(\b[Bb]lue[Pp]rint\b|\b[Bb][Pp]\b)[ \t#:]*([A-Za-z0-9\.-]+)`\0`g +' diff --git a/modules/openstack_project/manifests/git_backend.pp b/modules/openstack_project/manifests/git_backend.pp index 83819a1099..a6d53f4122 100644 --- a/modules/openstack_project/manifests/git_backend.pp +++ b/modules/openstack_project/manifests/git_backend.pp @@ -127,4 +127,11 @@ class openstack_project::git_backend ( 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', + } }