about summary refs log tree commit diff stats
path: root/shared.c
diff options
context:
space:
mode:
authorLars Hjemli2011-06-13 23:05:10 +0000
committerLars Hjemli2011-06-13 23:05:10 +0000
commit1b1bf635b59a349a9238a1d63a21d03d9949e185 (patch)
tree78d1501781d72f0698f673e9c44450e32118d843 /shared.c
parentcgitrc.5.txt: reformat the "FILTER API" section (diff)
parentcgit.c: add 'clone-url' setting with support for macro expansion (diff)
downloadcgit-1b1bf635b59a349a9238a1d63a21d03d9949e185.tar.gz
cgit-1b1bf635b59a349a9238a1d63a21d03d9949e185.zip
Merge branch 'lh/clone-url'
Diffstat (limited to 'shared.c')
-rw-r--r--shared.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shared.c b/shared.c index be2ae59..699c362 100644 --- a/shared.c +++ b/shared.c
@@ -70,6 +70,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
70 ret->about_filter = ctx.cfg.about_filter; 70 ret->about_filter = ctx.cfg.about_filter;
71 ret->commit_filter = ctx.cfg.commit_filter; 71 ret->commit_filter = ctx.cfg.commit_filter;
72 ret->source_filter = ctx.cfg.source_filter; 72 ret->source_filter = ctx.cfg.source_filter;
73 ret->clone_url = ctx.cfg.clone_url;
73 return ret; 74 return ret;
74} 75}
75 76
@@ -374,7 +375,8 @@ typedef struct {
374 char * value; 375 char * value;
375} cgit_env_var; 376} cgit_env_var;
376 377
377static void prepare_env(struct cgit_repo * repo) { 378void cgit_prepare_repo_env(struct cgit_repo * repo)
379{
378 cgit_env_var env_vars[] = { 380 cgit_env_var env_vars[] = {
379 { .name = "CGIT_REPO_URL", .value = repo->url }, 381 { .name = "CGIT_REPO_URL", .value = repo->url },
380 { .name = "CGIT_REPO_NAME", .value = repo->name }, 382 { .name = "CGIT_REPO_NAME", .value = repo->name },
@@ -395,7 +397,7 @@ static void prepare_env(struct cgit_repo * repo) {
395 fprintf(stderr, warn, p->name, p->value); 397 fprintf(stderr, warn, p->name, p->value);
396} 398}
397 399
398int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo) 400int cgit_open_filter(struct cgit_filter *filter)
399{ 401{
400 402
401 filter->old_stdout = chk_positive(dup(STDOUT_FILENO), 403 filter->old_stdout = chk_positive(dup(STDOUT_FILENO),
@@ -406,8 +408,6 @@ int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo)
406 close(filter->pipe_fh[1]); 408 close(filter->pipe_fh[1]);
407 chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO), 409 chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO),
408 "Unable to use pipe as STDIN"); 410 "Unable to use pipe as STDIN");
409 if (repo)
410 prepare_env(repo);
411 execvp(filter->cmd, filter->argv); 411 execvp(filter->cmd, filter->argv);
412 die("Unable to exec subprocess %s: %s (%d)", filter->cmd, 412 die("Unable to exec subprocess %s: %s (%d)", filter->cmd,
413 strerror(errno), errno); 413 strerror(errno), errno);