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 <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Ferry Huberts 2011-03-23 11:57:42 +01:00 committato da Lars Hjemli
parent 9240a828d1
commit d87bba846d
7 ha cambiato i file con 9 aggiunte e 9 eliminazioni

2
cgit.h
Vedi File

@ -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);

Vedi File

@ -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),

Vedi File

@ -110,7 +110,7 @@ void cgit_print_commit(char *hex, const char *prefix)
html("</table>\n");
html("<div class='commit-subject'>");
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("</div>");
html("<div class='commit-msg'>");
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("<div class='notes-header'>Notes</div>");
html("<div class='notes'>");
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);

Vedi File

@ -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);

Vedi File

@ -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;

Vedi File

@ -113,7 +113,7 @@ void cgit_print_repo_readme(char *path)
*/
html("<div id='summary'>");
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

Vedi File

@ -45,7 +45,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
if (ctx.repo->source_filter) {
html("<td class='lines'><pre><code>");
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("</code></pre></td></tr></table>\n");