Permalink
Browse files

More verbose pull hook output.

- Show last line and retval.
- Remove trailing whitespace.
  • Loading branch information...
1 parent 3281913 commit 88d3444140d9050452ca6a5622f2258ddfcf11bf @davidlehn davidlehn committed Feb 17, 2015
Showing with 9 additions and 7 deletions.
  1. +9 −7 utils/git.php
View
@@ -12,17 +12,19 @@
else if(flock($tfile, LOCK_EX | LOCK_NB))
{
$token = trim(fgets($tfile));
-
+
// check to make sure that the token value is correct
if(array_key_exists('token', $_GET) and $token === $_GET['token'])
{
// perform a git pull
chdir('..');
$gitdir = getcwd() . "/.git";
- system("git --git-dir $gitdir pull");
-
- echo 'git update successful';
-
+ $last_line = system("git --git-dir $gitdir pull", $last_line);
+
+ echo 'git pull last line: ' . $last_line . "\n";
+ echo 'git pull retval: ' . $retval . "\n";
+ echo 'git pull complete';
+
// Sleep for 5 seconds to throttle the update rate to 12 per minute
sleep(5);
}
@@ -31,11 +33,11 @@
echo 'ERROR: Invalid secret token provided. ' .
'See the README for more information.';
}
-
+
// Release the lock file
flock($tfile, LOCK_UN); // release the lock
}
-else
+else
{
echo 'ERROR: An update is currently being performed, ' .
'this request has been rejected.';

0 comments on commit 88d3444

Please sign in to comment.