2 <?php # vim:ts=2:sw=2:et:ft=php:
3 /* For licensing and copyright terms, see the file named LICENSE */
6 // git-commit-hook what [mtrackconfig] > /tmp/gitlog
7 // the cwd is the repo path
8 // a list of "oldrev newrev refname" lines is presented to us on stdin
11 die("MAKE INTO CLASS");
15 include dirname(__FILE__) . '/../inc/common.php';
17 require_once 'SCM/Git/CommitHookBridge.php';
19 MTrackConfig::checkInitializing();
21 //MTrackCommitChecker::addCheck('NoEmptyLogMessage');
22 //MTrackCommitChecker::addCheck('BlankLines');
23 //MTrackCommitChecker::addCheck('UnixLineBreak');
24 //MTrackCommitChecker::addCheck('SingleIssue');
26 //ini_set('display_errors', true);
31 $repo = MTrackRepo::loadByLocation(getcwd());
32 $bridge = new MTrack_SCM_Git_CommitHookBridge($repo);
34 // WTF is this for.. it the hook should be telling who the user is.
35 $author = 'www-data';//MTrackAuth::whoami();
36 $author = mtrack_canon_username($author);
37 MTrackAuth::su($author);
39 $checker = new MTrackCommitChecker($repo);
44 $checker->preCommit($bridge);
48 $checker->postCommit($bridge);
56 } catch (Exception $e) {
58 fwrite(STDERR, "\n" . $e->getMessage() .
60 $e->getTraceAsString() .
61 "\n\n ** Commit failed [$action]\n");