From 0d744969c390b69d0780b8c1040d92e37f6dd74f Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 5 Nov 2009 01:02:12 +0100 Subject: [PATCH] ref-change: Make the first command parameter the uid of pusher --- Girocco/Notify.pm | 2 +- post-receive-hook | 2 +- taskd/taskd.pl | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Girocco/Notify.pm b/Girocco/Notify.pm index 00c08de..a672f15 100644 --- a/Girocco/Notify.pm +++ b/Girocco/Notify.pm @@ -127,7 +127,7 @@ sub get_commits { sub ref_change { - my ($proj, $ref, $oldrev, $newrev) = @_; + my ($proj, $user, $ref, $oldrev, $newrev) = @_; chdir($proj->{path}); diff --git a/post-receive-hook b/post-receive-hook index 22679f2..f85925b 100755 --- a/post-receive-hook +++ b/post-receive-hook @@ -21,7 +21,7 @@ fi [ -S "$sockpath" ] || exit 0 while read line; do - echo "ref-change ${projname%.git} $line" + echo "ref-change $UID ${projname%.git} $line" done | /bin/nc.openbsd -w 1 -U "$sockpath" exit diff --git a/taskd/taskd.pl b/taskd/taskd.pl index 35dafd6..fc5a27c 100755 --- a/taskd/taskd.pl +++ b/taskd/taskd.pl @@ -33,6 +33,7 @@ use warnings; use Girocco::Config; use Girocco::Notify; use Girocco::Project; +use Girocco::User; use Socket; $| = 1; @@ -93,12 +94,20 @@ sub clone { sub ref_change { my ($arg) = @_; - my ($name, $oldrev, $newrev, $ref) = split(/\s+/, $arg); + my ($uid, $name, $oldrev, $newrev, $ref) = split(/\s+/, $arg); + my $proj = Girocco::Project->load($name); $proj or die "failed to load project $name"; - print STDERR "ref-change $name ($ref: $oldrev -> $newrev)\n"; + + my $user; + if ($uid >= 0) { + $user = Girocco::User->load_by_uid($uid); + $user or die "failed to load user $uid"; + } + + print STDERR "ref-change $uid $name ($ref: $oldrev -> $newrev)\n"; open STDIN, "