Skip to content

Commit

Permalink
More verbose pull hook output.
Browse files Browse the repository at this point in the history
- Show last line and retval.
- Remove trailing whitespace.
  • Loading branch information
davidlehn committed Feb 17, 2015
1 parent 3281913 commit 88d3444
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions utils/git.php
Expand Up @@ -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);
}
Expand All @@ -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.';
Expand Down

0 comments on commit 88d3444

Please sign in to comment.