composer update
This commit is contained in:
61
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Branch.php
vendored
Normal file
61
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Branch.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Gitonomy.
|
||||
*
|
||||
* (c) Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
* (c) Julien DIDIER <genzo.wm@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
namespace Gitonomy\Git\Reference;
|
||||
|
||||
use Gitonomy\Git\Exception\RuntimeException;
|
||||
use Gitonomy\Git\Reference;
|
||||
|
||||
/**
|
||||
* Representation of a branch reference.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class Branch extends Reference
|
||||
{
|
||||
private $local = null;
|
||||
|
||||
public function getName()
|
||||
{
|
||||
$fullname = $this->getFullname();
|
||||
|
||||
if (preg_match('#^refs/heads/(?<name>.*)$#', $fullname, $vars)) {
|
||||
return $vars['name'];
|
||||
}
|
||||
|
||||
if (preg_match('#^refs/remotes/(?<remote>[^/]*)/(?<name>.*)$#', $fullname, $vars)) {
|
||||
return $vars['remote'].'/'.$vars['name'];
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('Cannot extract branch name from "%s"', $fullname));
|
||||
}
|
||||
|
||||
public function isRemote()
|
||||
{
|
||||
$this->detectBranchType();
|
||||
|
||||
return !$this->local;
|
||||
}
|
||||
|
||||
public function isLocal()
|
||||
{
|
||||
$this->detectBranchType();
|
||||
|
||||
return $this->local;
|
||||
}
|
||||
|
||||
private function detectBranchType()
|
||||
{
|
||||
if (null === $this->local) {
|
||||
$this->local = !preg_match('#^refs/remotes/(?<remote>[^/]*)/(?<name>.*)$#', $this->getFullname());
|
||||
}
|
||||
}
|
||||
}
|
25
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Stash.php
vendored
Normal file
25
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Stash.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Gitonomy.
|
||||
*
|
||||
* (c) Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
* (c) Julien DIDIER <genzo.wm@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
namespace Gitonomy\Git\Reference;
|
||||
|
||||
use Gitonomy\Git\Reference;
|
||||
|
||||
/**
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class Stash extends Reference
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'stash';
|
||||
}
|
||||
}
|
32
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Tag.php
vendored
Normal file
32
vendor/gitonomy/gitlib/src/Gitonomy/Git/Reference/Tag.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Gitonomy.
|
||||
*
|
||||
* (c) Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
* (c) Julien DIDIER <genzo.wm@gmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
namespace Gitonomy\Git\Reference;
|
||||
|
||||
use Gitonomy\Git\Exception\RuntimeException;
|
||||
use Gitonomy\Git\Reference;
|
||||
|
||||
/**
|
||||
* Representation of a tag reference.
|
||||
*
|
||||
* @author Alexandre Salomé <alexandre.salome@gmail.com>
|
||||
*/
|
||||
class Tag extends Reference
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
if (!preg_match('#^refs/tags/(.*)$#', $this->revision, $vars)) {
|
||||
throw new RuntimeException(sprintf('Cannot extract tag name from "%s"', $this->revision));
|
||||
}
|
||||
|
||||
return $vars[1];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user