summaryrefslogtreecommitdiff
path: root/IkiWiki/Wrapper.pm
diff options
context:
space:
mode:
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}";