From: Ferry Huberts Date: Thu, 17 Feb 2011 21:11:08 GMT Subject: [CGit] [PATCH 5/6] commit_filter: also communicate the repo name to the filter Message-ID: <1297977069-21884-6-git-send-email-mailings@hupie.com> In-Reply-To: <1297977069-21884-1-git-send-email-mailings@hupie.com> From: Ferry Huberts Signed-off-by: Ferry Huberts --- cgit.c | 5 ++++- filters/commit-links.sh | 2 ++ ui-commit.c | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cgit.c b/cgit.c index 65c892c..9e8c4c4 100644 --- a/cgit.c +++ b/cgit.c @@ -41,10 +41,13 @@ struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) switch (filtertype) { case about: - case commit: extra_args = 0; break; + case commit: + extra_args = 1; + break; + case source: extra_args = 2; break; diff --git a/filters/commit-links.sh b/filters/commit-links.sh index 110c609..d098cd5 100755 --- a/filters/commit-links.sh +++ b/filters/commit-links.sh @@ -3,6 +3,8 @@ # # To use this script, refer to this file with either the commit-filter or the # repo.commit-filter options in cgitrc. +# +# 1st argument is the repo name # This expression generates links to commits referenced by their SHA1. regex=$regex' diff --git a/ui-commit.c b/ui-commit.c index 2b4f677..b0607d0 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -109,8 +109,11 @@ void cgit_print_commit(char *hex, const char *prefix) } html("\n"); html("
"); - if (ctx.repo->commit_filter) + if (ctx.repo->commit_filter) { + if (!ctx.repo->commit_filter->argv[1]) + ctx.repo->commit_filter->argv[1] = xstrdup(ctx.repo->name); cgit_open_filter(ctx.repo->commit_filter); + } html_txt(info->subject); if (ctx.repo->commit_filter) cgit_close_filter(ctx.repo->commit_filter); -- 1.7.4