From mboxrd@z Thu Jan 1 00:00:00 1970 From: mailings at hupie.com (Ferry Huberts) Date: Mon, 29 Sep 2014 20:09:48 +0200 Subject: Integration with Bugzilla? In-Reply-To: References: Message-ID: <5429A06C.30707@hupie.com> On 29/09/14 19:49, Joey Reid wrote: > I often run into situations where the git commit log references a > bugzilla report. Such as this one > > http://cgit.freedesktop.org/libreoffice/core/commit/?id=559484d5871c7c0a7e771f75916c46f3a6a590ae > > > Where fdo#60123 Refers to > https://bugs.freedesktop.org/show_bug.cgi?id=60123 > > or this one where the bug is #i125581# > https://github.com/apache/openoffice/commit/8cb619bd314a80fe7f7094b16f25d362979f0c69 > > Is it possible to have cgit parse the subject for fdo# or > #i# and replace the plain text with a hyperlink containing > ? > > Sure. The below script is what I use on my server to refer to a trac ticket. --- #!/bin/bash # # This script can be used to generate links in commit messages. # # To use this script, refer to this file with either the commit-filter or the # repo.commit-filter options in cgitrc. # # 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 ) # declare regex="" # # Commit SHA1 # regex="s|\b([0-9a-fA-F]{7,40})\b|\1|g" # # Trac # # We have a trac instance for every repository, # located under /reposerf/trac/repoName # if [[ -n "${CGIT_REPO_PATH:-}" ]]; then regex="$regex s|#([0-9]+)\b|#\1|g" fi sed -re "$regex"