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>
Dieser Commit ist enthalten in:
Ursprung
9240a828d1
Commit
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_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 cgit_close_filter(struct cgit_filter *filter);
|
||||||
|
|
||||||
extern int readfile(const char *path, char **buf, size_t *size);
|
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;
|
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),
|
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("</table>\n");
|
||||||
html("<div class='commit-subject'>");
|
html("<div class='commit-subject'>");
|
||||||
if (ctx.repo->commit_filter)
|
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);
|
html_txt(info->subject);
|
||||||
if (ctx.repo->commit_filter)
|
if (ctx.repo->commit_filter)
|
||||||
cgit_close_filter(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>");
|
||||||
html("<div class='commit-msg'>");
|
html("<div class='commit-msg'>");
|
||||||
if (ctx.repo->commit_filter)
|
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);
|
html_txt(info->msg);
|
||||||
if (ctx.repo->commit_filter)
|
if (ctx.repo->commit_filter)
|
||||||
cgit_close_filter(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-header'>Notes</div>");
|
||||||
html("<div class='notes'>");
|
html("<div class='notes'>");
|
||||||
if (ctx.repo->commit_filter)
|
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);
|
html_txt(notes.buf);
|
||||||
if (ctx.repo->commit_filter)
|
if (ctx.repo->commit_filter)
|
||||||
cgit_close_filter(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)
|
if (!ctx.cfg.root_readme)
|
||||||
return;
|
return;
|
||||||
if (ctx.cfg.about_filter)
|
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);
|
html_include(ctx.cfg.root_readme);
|
||||||
if (ctx.cfg.about_filter)
|
if (ctx.cfg.about_filter)
|
||||||
cgit_close_filter(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 = malloc(2 * sizeof(char *));
|
||||||
f.argv[0] = f.cmd;
|
f.argv[0] = f.cmd;
|
||||||
f.argv[1] = NULL;
|
f.argv[1] = NULL;
|
||||||
cgit_open_filter(&f);
|
cgit_open_filter(&f, NULL);
|
||||||
rv = write_tar_archive(args);
|
rv = write_tar_archive(args);
|
||||||
cgit_close_filter(&f);
|
cgit_close_filter(&f);
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -113,7 +113,7 @@ void cgit_print_repo_readme(char *path)
|
|||||||
*/
|
*/
|
||||||
html("<div id='summary'>");
|
html("<div id='summary'>");
|
||||||
if (ctx.repo->about_filter)
|
if (ctx.repo->about_filter)
|
||||||
cgit_open_filter(ctx.repo->about_filter);
|
cgit_open_filter(ctx.repo->about_filter, ctx.repo);
|
||||||
if (ref)
|
if (ref)
|
||||||
cgit_print_file(tmp, ref);
|
cgit_print_file(tmp, ref);
|
||||||
else
|
else
|
||||||
|
@ -45,7 +45,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
|
|||||||
if (ctx.repo->source_filter) {
|
if (ctx.repo->source_filter) {
|
||||||
html("<td class='lines'><pre><code>");
|
html("<td class='lines'><pre><code>");
|
||||||
ctx.repo->source_filter->argv[1] = xstrdup(name);
|
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);
|
html_raw(buf, size);
|
||||||
cgit_close_filter(ctx.repo->source_filter);
|
cgit_close_filter(ctx.repo->source_filter);
|
||||||
html("</code></pre></td></tr></table>\n");
|
html("</code></pre></td></tr></table>\n");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren