Skip to content

Commit aef6efe

Browse files
author
alexandresalome
committed
add support for stash
1 parent 6ba4c35 commit aef6efe

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

src/Gitonomy/Git/Log.php

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

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

src/Gitonomy/Git/Reference/Stash.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/**
4+
* This file is part of Gitonomy.
5+
*
6+
* (c) Alexandre Salomé <[email protected]>
7+
* (c) Julien DIDIER <[email protected]>
8+
*
9+
* This source file is subject to the GPL license that is bundled
10+
* with this source code in the file LICENSE.
11+
*/
12+
13+
namespace Gitonomy\Git\Reference;
14+
15+
use Gitonomy\Git\Reference;
16+
17+
/**
18+
* @author Alexandre Salomé <[email protected]>
19+
*/
20+
class Stash extends Reference
21+
{
22+
/**
23+
* {@inheritdoc}
24+
*/
25+
public function getName()
26+
{
27+
return 'stash';
28+
}
29+
}

src/Gitonomy/Git/ReferenceBag.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use Gitonomy\Git\Exception\ReferenceNotFoundException;
1616
use Gitonomy\Git\Exception\RuntimeException;
17+
use Gitonomy\Git\Reference\Stash;
1718
use Gitonomy\Git\Reference\Branch;
1819
use Gitonomy\Git\Reference\Tag;
1920

@@ -355,13 +356,16 @@ protected function initialize()
355356
if (preg_match('#.*HEAD$#', $fullname)) {
356357
continue;
357358
}
358-
$reference = new Reference\Branch($this->repository, $fullname, $commitHash);
359+
$reference = new Branch($this->repository, $fullname, $commitHash);
359360
$this->references[$fullname] = $reference;
360361
$this->branches[] = $reference;
361362
} elseif (preg_match('#^refs/tags/(.*)$#', $fullname)) {
362-
$reference = new Reference\Tag($this->repository, $fullname, $commitHash);
363+
$reference = new Tag($this->repository, $fullname, $commitHash);
363364
$this->references[$fullname] = $reference;
364365
$this->tags[] = $reference;
366+
} elseif ($fullname === 'refs/stash') {
367+
$reference = new Stash($this->repository, $fullname, $commitHash);
368+
$this->references[$fullname] = $reference;
365369
} else {
366370
throw new \RuntimeException(sprintf('Unable to parse "%s"', $fullname));
367371
}

0 commit comments

Comments
 (0)