X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/90923561734f17ad777237bed5e7b40e682344eb..99292550fdf3c5bf9feb4a665e2de99f5cfc0d35:/IkiWiki/Wrapper.pm?ds=sidebyside diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 85d259117..d72368446 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -19,6 +19,9 @@ sub gen_wrapper () { #{{{ error("cannot create a wrapper that uses a setup file"); } my $wrapper=possibly_foolish_untaint($config{wrapper}); + if (! defined $wrapper || ! length $wrapper) { + error("wrapper filename not specified"); + } delete $config{wrapper}; my @envsave; @@ -32,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']); @@ -52,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}";