Automatically migrated from Gitolite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.0 KiB

<?php
class GitCommit extends GitObject
{
public $tree = "";
public $author = "";
public $committer = "";
public $message = "";
public $parents = array();
function __construct($repo, $headerdata, $data)
{
parent::__construct($repo, $headerdata, $data);
$lines = explode("\n", $data);
$message_parts = array();
$parsing_message = false;
foreach($lines as $line)
{
$line = trim($line);
if(!empty($line))
{
if($parsing_message === false)
{
list($key, $value) = explode(" ", $line, 2);
switch($key)
{
case "tree":
$this->tree = $value;
break;
case "parent":
$this->parents[] = $value;
break;
case "committer":
$this->committer = new GitActor($value);
break;
case "author":
$this->author = new GitActor($value);
break;
}
}
else
{
$message_parts[] = $line;
}
}
else
{
$parsing_message = true;
}
}
$this->message = implode("\n", $message_parts);
}
}