From d87bba846d368e560193a1f75de6d66bffe986cf Mon Sep 17 00:00:00 2001 From: Ferry Huberts Date: Wed, 23 Mar 2011 11:57:42 +0100 Subject: cgit_open_filter: also take the repo as a parameter To prepare for handing repo configuration to the filter script that is executed. Signed-off-by: Ferry Huberts Signed-off-by: Lars Hjemli --- cgit.h | 2 +- shared.c | 2 +- ui-commit.c | 6 +++--- ui-repolist.c | 2 +- ui-snapshot.c | 2 +- ui-summary.c | 2 +- ui-tree.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cgit.h b/cgit.h index 1f8b1be..3b0eaf5 100644 --- a/cgit.h +++ b/cgit.h @@ -318,7 +318,7 @@ extern const char *cgit_repobasename(const char *reponame); extern int cgit_parse_snapshots_mask(const char *str); -extern int cgit_open_filter(struct cgit_filter *filter); +extern int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo); extern int cgit_close_filter(struct cgit_filter *filter); extern int readfile(const char *path, char **buf, size_t *size); diff --git a/shared.c b/shared.c index 7ec2e19..e4879df 100644 --- a/shared.c +++ b/shared.c @@ -376,7 +376,7 @@ int cgit_parse_snapshots_mask(const char *str) return rv; } -int cgit_open_filter(struct cgit_filter *filter) +int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo) { filter->old_stdout = chk_positive(dup(STDOUT_FILENO), diff --git a/ui-commit.c b/ui-commit.c index 2b4f677..2da9fcf 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -110,7 +110,7 @@ void cgit_print_commit(char *hex, const char *prefix) html("\n"); html("
"); if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter, ctx.repo); html_txt(info->subject); if (ctx.repo->commit_filter) cgit_close_filter(ctx.repo->commit_filter); @@ -118,7 +118,7 @@ void cgit_print_commit(char *hex, const char *prefix) html("
"); html("
"); if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter, ctx.repo); html_txt(info->msg); if (ctx.repo->commit_filter) cgit_close_filter(ctx.repo->commit_filter); @@ -127,7 +127,7 @@ void cgit_print_commit(char *hex, const char *prefix) html("
Notes
"); html("
"); if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter, ctx.repo); html_txt(notes.buf); if (ctx.repo->commit_filter) cgit_close_filter(ctx.repo->commit_filter); diff --git a/ui-repolist.c b/ui-repolist.c index 2c98668..05b4548 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -291,7 +291,7 @@ void cgit_print_site_readme() if (!ctx.cfg.root_readme) return; if (ctx.cfg.about_filter) - cgit_open_filter(ctx.cfg.about_filter); + cgit_open_filter(ctx.cfg.about_filter, NULL); html_include(ctx.cfg.root_readme); if (ctx.cfg.about_filter) cgit_close_filter(ctx.cfg.about_filter); diff --git a/ui-snapshot.c b/ui-snapshot.c index 6e3412c..067082c 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -19,7 +19,7 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f f.argv = malloc(2 * sizeof(char *)); f.argv[0] = f.cmd; f.argv[1] = NULL; - cgit_open_filter(&f); + cgit_open_filter(&f, NULL); rv = write_tar_archive(args); cgit_close_filter(&f); return rv; diff --git a/ui-summary.c b/ui-summary.c index 5be2545..1e9a1b6 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -113,7 +113,7 @@ void cgit_print_repo_readme(char *path) */ html("
"); if (ctx.repo->about_filter) - cgit_open_filter(ctx.repo->about_filter); + cgit_open_filter(ctx.repo->about_filter, ctx.repo); if (ref) cgit_print_file(tmp, ref); else diff --git a/ui-tree.c b/ui-tree.c index 0b1b531..835c166 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -45,7 +45,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size) if (ctx.repo->source_filter) { html("
");
 		ctx.repo->source_filter->argv[1] = xstrdup(name);
-		cgit_open_filter(ctx.repo->source_filter);
+		cgit_open_filter(ctx.repo->source_filter, ctx.repo);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
 		html("
\n"); -- cgit v1.2.3