Skip to content

Commit 0cffb18

Browse files
committed
Added ref_name parameter to repo commits calls
1 parent 3647ee5 commit 0cffb18

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lib/Gitlab/Api/Repositories.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ public function tags($project_id)
2020
return $this->get('projects/'.urlencode($project_id).'/repository/tags');
2121
}
2222

23-
public function commits($project_id, $page = 1, $per_page = self::PER_PAGE)
23+
public function commits($project_id, $page = 1, $per_page = self::PER_PAGE, $ref_name = null)
2424
{
2525
return $this->get('projects/'.urlencode($project_id).'/repository/commits', array(
2626
'page' => $page,
27-
'per_page' => $per_page
27+
'per_page' => $per_page,
28+
'ref_name' => $ref_name
2829
));
2930
}
3031

lib/Gitlab/Model/Branch.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Gitlab\Model;
44

55
use Gitlab\Client;
6+
use Gitlab\Api\AbstractApi as Api;
67

78
class Branch extends AbstractModel
89
{
@@ -52,4 +53,9 @@ public function unprotect()
5253

5354
return Branch::fromArray($this->getClient(), $this->project, $data);
5455
}
56+
57+
public function commits($page = 1, $per_page = Api::PER_PAGE)
58+
{
59+
return $this->project->commits($page, $per_page, $this->name);
60+
}
5561
}

lib/Gitlab/Model/Project.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ public function tags()
219219
return $tags;
220220
}
221221

222-
public function commits($page = 1, $per_page = Api::PER_PAGE)
222+
public function commits($page = 1, $per_page = Api::PER_PAGE, $ref_name = null)
223223
{
224-
$data = $this->api('repo')->commits($this->id, $page, $per_page);
224+
$data = $this->api('repo')->commits($this->id, $page, $per_page, $ref_name);
225225

226226
$commits = array();
227227
foreach ($data as $commit) {

0 commit comments

Comments
 (0)