aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Wrapper.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-04-25 00:22:41 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-04-25 00:22:41 +0000
commitb7f64d884cd8bd8e1d9e8fb75735530d4c8a135d (patch)
treee224f6a9e74329e3d5b894a3e885c9a99c3bca5f /IkiWiki/Wrapper.pm
parenta804c92abd4b0c2955c7d397b7dddc1620249218 (diff)
downloadikiwiki-b7f64d884cd8bd8e1d9e8fb75735530d4c8a135d.tar
ikiwiki-b7f64d884cd8bd8e1d9e8fb75735530d4c8a135d.tar.gz
subscription nearly done
Diffstat (limited to 'IkiWiki/Wrapper.pm')
-rw-r--r--IkiWiki/Wrapper.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index 238f71a91..d72368446 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -28,7 +28,6 @@ sub gen_wrapper () { #{{{
push @envsave, qw{REMOTE_ADDR QUERY_STRING REQUEST_METHOD REQUEST_URI
CONTENT_TYPE CONTENT_LENGTH GATEWAY_INTERFACE
HTTP_COOKIE} if $config{cgi};
- push @envsave, qw{REV} if $config{svn};
my $envsave="";
foreach my $var (@envsave) {
$envsave.=<<"EOF"
@@ -36,6 +35,16 @@ sub gen_wrapper () { #{{{
asprintf(&newenviron[i++], "%s=%s", "$var", s);
EOF
}
+ if ($config{svn} && $config{notify}) {
+ # Support running directly as hooks/post-commit by passing
+ # $2 in REV in the environment.
+ $envsave.=<<"EOF"
+ if (argc == 3)
+ asprintf(&newenviron[i++], "REV=%s", argv[2]);
+ else if ((s=getenv("REV")))
+ asprintf(&newenviron[i++], "%s=%s", "REV", s);
+EOF
+ }
$Data::Dumper::Indent=0; # no newlines
my $configstring=Data::Dumper->Dump([\%config], ['*config']);
@@ -56,7 +65,7 @@ extern char **environ;
int main (int argc, char **argv) {
/* Sanitize environment. */
char *s;
- char *newenviron[$#envsave+4];
+ char *newenviron[$#envsave+5];
int i=0;
$envsave
newenviron[i++]="HOME=$ENV{HOME}";