On 05/24/2011 12:10 AM, Lars Hjemli wrote:
> First off, sorry for the silence+latency, and thanks for all the
> patches! I've finally gotten around to process some of them, and the
> result has been pushed to hjemli.net/git/cgit:
> 
...
> Ferry Huberts (4):
>       new_filter: determine extra_args from filter type
>       cgit_open_filter: also take the repo as a parameter
>       cgit_open_filter: hand down repo configuration to script
>       filters: document environment variables in filter scripts

These patches are now working for me on my git server :-)

I've included the script as an example.

PS. Lars: this script is an 'improved' version over the one in the tree,
do you want a patch for it?

grtz

-- 
Ferry Huberts
#!/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 )
#

#
# Commit SHA1
#
regexSha="(^|[[:space:]]+)([0-9a-fA-F]{7,40})([^0-9a-fA-F]+|\$)"

#
# Trac
#
# We have a trac instance for every repository,
# located under /trac/repoName
#
tracWwwDir="/trac"
reponame="$(basename "${CGIT_REPO_PATH}")"
regexTracTicket="(^|[[:space:]]+)(#)([0-9]+)([^0-9]+|\$)"

sed -r \
    -e "s@${regexTracTicket}@\1<a 
href=\"${tracWwwDir}/${reponame}/ticket/\3\">\2\3</a>\4@g" \
    -e "s@${regexSha}@\1<a href=\"./?id=\2\">\2</a>\3@g"

_______________________________________________
cgit mailing list
[email protected]
http://hjemli.net/mailman/listinfo/cgit

Reply via email to