aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Ferry Huberts <ferry.huberts@pelagic.nl>2011-03-23 19:57:42 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2011-03-26 19:03:42 (JST)
commitd87bba846d368e560193a1f75de6d66bffe986cf (patch)
treeec74dbc35f2b0dfb5e5ef494bb27bcc097f4e922
parent9240a828d13fa8f6a9e379b94b2061ca83e6199c (diff)
downloadcgit-d87bba846d368e560193a1f75de6d66bffe986cf.zip
cgit-d87bba846d368e560193a1f75de6d66bffe986cf.tar.gz
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>
-rw-r--r--cgit.h2
-rw-r--r--shared.c2
-rw-r--r--ui-commit.c6
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-snapshot.c2
-rw-r--r--ui-summary.c2
-rw-r--r--ui-tree.c2
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);
318 318
319extern int cgit_parse_snapshots_mask(const char *str); 319extern int cgit_parse_snapshots_mask(const char *str);
320 320
321extern int cgit_open_filter(struct cgit_filter *filter); 321extern int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo);
322extern int cgit_close_filter(struct cgit_filter *filter); 322extern int cgit_close_filter(struct cgit_filter *filter);
323 323
324extern int readfile(const char *path, char **buf, size_t *size); 324extern 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)
376 return rv; 376 return rv;
377} 377}
378 378
379int cgit_open_filter(struct cgit_filter *filter) 379int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo)
380{ 380{
381 381
382 filter->old_stdout = chk_positive(dup(STDOUT_FILENO), 382 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)
110 html("</table>\n"); 110 html("</table>\n");
111 html("<div class='commit-subject'>"); 111 html("<div class='commit-subject'>");
112 if (ctx.repo->commit_filter) 112 if (ctx.repo->commit_filter)
113 cgit_open_filter(ctx.repo->commit_filter); 113 cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
114 html_txt(info->subject); 114 html_txt(info->subject);
115 if (ctx.repo->commit_filter) 115 if (ctx.repo->commit_filter)
116 cgit_close_filter(ctx.repo->commit_filter); 116 cgit_close_filter(ctx.repo->commit_filter);
@@ -118,7 +118,7 @@ void cgit_print_commit(char *hex, const char *prefix)
118 html("</div>"); 118 html("</div>");
119 html("<div class='commit-msg'>"); 119 html("<div class='commit-msg'>");
120 if (ctx.repo->commit_filter) 120 if (ctx.repo->commit_filter)
121 cgit_open_filter(ctx.repo->commit_filter); 121 cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
122 html_txt(info->msg); 122 html_txt(info->msg);
123 if (ctx.repo->commit_filter) 123 if (ctx.repo->commit_filter)
124 cgit_close_filter(ctx.repo->commit_filter); 124 cgit_close_filter(ctx.repo->commit_filter);
@@ -127,7 +127,7 @@ void cgit_print_commit(char *hex, const char *prefix)
127 html("<div class='notes-header'>Notes</div>"); 127 html("<div class='notes-header'>Notes</div>");
128 html("<div class='notes'>"); 128 html("<div class='notes'>");
129 if (ctx.repo->commit_filter) 129 if (ctx.repo->commit_filter)
130 cgit_open_filter(ctx.repo->commit_filter); 130 cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
131 html_txt(notes.buf); 131 html_txt(notes.buf);
132 if (ctx.repo->commit_filter) 132 if (ctx.repo->commit_filter)
133 cgit_close_filter(ctx.repo->commit_filter); 133 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()
291 if (!ctx.cfg.root_readme) 291 if (!ctx.cfg.root_readme)
292 return; 292 return;
293 if (ctx.cfg.about_filter) 293 if (ctx.cfg.about_filter)
294 cgit_open_filter(ctx.cfg.about_filter); 294 cgit_open_filter(ctx.cfg.about_filter, NULL);
295 html_include(ctx.cfg.root_readme); 295 html_include(ctx.cfg.root_readme);
296 if (ctx.cfg.about_filter) 296 if (ctx.cfg.about_filter)
297 cgit_close_filter(ctx.cfg.about_filter); 297 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
19 f.argv = malloc(2 * sizeof(char *)); 19 f.argv = malloc(2 * sizeof(char *));
20 f.argv[0] = f.cmd; 20 f.argv[0] = f.cmd;
21 f.argv[1] = NULL; 21 f.argv[1] = NULL;
22 cgit_open_filter(&f); 22 cgit_open_filter(&f, NULL);
23 rv = write_tar_archive(args); 23 rv = write_tar_archive(args);
24 cgit_close_filter(&f); 24 cgit_close_filter(&f);
25 return rv; 25 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)
113 */ 113 */
114 html("<div id='summary'>"); 114 html("<div id='summary'>");
115 if (ctx.repo->about_filter) 115 if (ctx.repo->about_filter)
116 cgit_open_filter(ctx.repo->about_filter); 116 cgit_open_filter(ctx.repo->about_filter, ctx.repo);
117 if (ref) 117 if (ref)
118 cgit_print_file(tmp, ref); 118 cgit_print_file(tmp, ref);
119 else 119 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)
45 if (ctx.repo->source_filter) { 45 if (ctx.repo->source_filter) {
46 html("<td class='lines'><pre><code>"); 46 html("<td class='lines'><pre><code>");
47 ctx.repo->source_filter->argv[1] = xstrdup(name); 47 ctx.repo->source_filter->argv[1] = xstrdup(name);
48 cgit_open_filter(ctx.repo->source_filter); 48 cgit_open_filter(ctx.repo->source_filter, ctx.repo);
49 html_raw(buf, size); 49 html_raw(buf, size);
50 cgit_close_filter(ctx.repo->source_filter); 50 cgit_close_filter(ctx.repo->source_filter);
51 html("</code></pre></td></tr></table>\n"); 51 html("</code></pre></td></tr></table>\n");