1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17: class Horde_Vcs_QuickLog_Git extends Horde_Vcs_QuickLog_Base
18: {
19: 20: 21: 22: 23: 24: 25: 26: 27:
28: public function __construct($rep, $rev, $date = null, $author = null,
29: $log = null)
30: {
31: parent::__construct($rep, $rev);
32:
33: $cmd = 'log --no-color --pretty=format:"%H%x00%an <%ae>%x00%at%x00%s%x00%b%n%x00" --no-abbrev -n 1 ' . escapeshellarg($this->_rev);
34: list($resource, $pipe) = $this->_rep->runCommand($cmd);
35:
36: $log = '';
37: while (!feof($pipe) && ($line = fgets($pipe)) && $line != "\0\n") {
38: $log .= $line;
39: }
40:
41: $fields = explode("\0", substr($log, 0, -1));
42: fclose($pipe);
43: proc_close($resource);
44: if ($this->_rev != $fields[0]) {
45: throw new Horde_Vcs_Exception(
46: 'Expected ' . $this->_rev . ', got ' . $fields[0]);
47: }
48: $this->_author = $fields[1];
49: $this->_date = $fields[2];
50: $this->_log = trim($fields[3] . "\n\n" . $fields[4]);
51: }
52: }
53: