Skip to content

Commit 57db5e2

Browse files
author
alexandresalome
committed
add convenience methods
1 parent 1ef8d5f commit 57db5e2

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/Gitonomy/Git/Commit.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ public function getShortMessage($length = 50, $preserve = false, $separator = '.
291291
return $message;
292292
}
293293

294+
/**
295+
* Resolves all references associated to this commit.
296+
*
297+
* @return array An array of references (Branch, Tag, Squash)
298+
*/
299+
public function resolveReferences()
300+
{
301+
return $this->repository->getReferences()->resolve($this);
302+
}
303+
294304
/**
295305
* Find branch containing the commit
296306
*

src/Gitonomy/Git/Log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Log implements \Countable, \IteratorAggregate
4444
*/
4545
protected $limit;
4646

47-
public function __construct(Repository $repository, $revisions, $paths, $offset = 0, $limit = null)
47+
public function __construct(Repository $repository, $revisions, $paths = null, $offset = 0, $limit = null)
4848
{
4949
$this->repository = $repository;
5050
$this->revisions = (array) $revisions;

src/Gitonomy/Git/Reference.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,20 @@ public function delete()
103103
{
104104
$this->repository->getReferences()->delete($this->getFullname());
105105
}
106+
107+
/**
108+
* @return Repository
109+
*/
110+
public function getRepository()
111+
{
112+
return $this->repository;
113+
}
114+
115+
/**
116+
* @return Log
117+
*/
118+
public function getLog()
119+
{
120+
return new Log($this->repository, $this->getFullname());
121+
}
106122
}

0 commit comments

Comments
 (0)