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>
Этот коммит содержится в:
родитель
9240a828d1
Коммит
d87bba846d
2
cgit.h
2
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);
|
||||
|
2
shared.c
2
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),
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user