tan-tan-kanarek / github-php-client

MIT License
184 stars 120 forks source link

Committer info not retrieved? #14

Closed barkgj closed 10 years ago

barkgj commented 10 years ago

Hi,

I am trying to retrieve the date of a commit;

foreach($commits as $commit) { $c = $commit->getCommit(); $message = $c->getMessage(); $committer = $c->getCommitter(); // EMPTY :( $author = $c->getAuthor(); // EMPTY :( ...

The $message variable is set perfectly, but unfortunately both $committer and $author are blank when I var_dump them. Is this part not yet implemented perhaps? Or do I do something wrong?

Would hope you can help me out,

Regards, Gert-Jan

tan-tan-kanarek commented 10 years ago

The following code worked for me:

$client->setPage();
$client->setPageSize(4);

$commits = $client->repos->commits->listCommitsOnRepository($owner, $repo);

foreach($commits as $commit)
{
    /* @var $commit GitHubCommit */
    $sha = $commit->getSha();
    $url = $commit->getUrl();
    $message = $commit->getCommit()->getMessage();
    $committerLoginName = $commit->getCommitter()->getLogin();
    $authorLoginName = $commit->getAuthor()->getLogin();

    echo "<A href=\"$url\">$sha</A> - [$committerLoginName/$authorLoginName] $message<BR/>\n";
}

Unfortunately, date is not provided by GitHub API.