diff --git a/composer.json b/composer.json index 167c24d..3469e23 100644 --- a/composer.json +++ b/composer.json @@ -11,20 +11,15 @@ ], "require": { "php": ">=5.3.2", - "symfony/process":">=2.3", - "symfony/options-resolver": ">=2.3" + "symfony/process":"~2.0", + "symfony/options-resolver": "~2.0" }, "require-dev": { - "symfony/filesystem": ">=2.3" + "symfony/filesystem": "~2.0" }, "autoload": { "psr-0": { "": "src" } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } } } \ No newline at end of file diff --git a/src/PHPGit/Command/BranchCommand.php b/src/PHPGit/Command/BranchCommand.php index 4b42f50..353dc74 100644 --- a/src/PHPGit/Command/BranchCommand.php +++ b/src/PHPGit/Command/BranchCommand.php @@ -64,7 +64,10 @@ public function __invoke(array $options = array()) foreach ($lines as $line) { $branch = array(); - preg_match('/(?\*| ) (?[^\s]+) +((?:->) (?[^\s]+)|(?[0-9a-z]{7}) (?.*))/', $line, $matches); + preg_match('/(?<current>\*| ) (?<name>[^\s]+)?(?<nobranch>\([\s\w]+\))? +((?:->) (?<alias>[^\s]+)|(?<hash>[0-9a-z]{7}) (?<title>.*))/', $line, $matches); + if (key_exists('nobranch', $matches) && $matches['nobranch']) { + $matches['name'] = $matches['nobranch']; + } $branch['current'] = ($matches['current'] == '*'); $branch['name'] = $matches['name']; @@ -226,4 +229,4 @@ protected function getProcessBuilder() ->add('branch'); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/PHPGit/Git.php b/src/PHPGit/Git.php index f952d6f..b2d3ff2 100644 --- a/src/PHPGit/Git.php +++ b/src/PHPGit/Git.php @@ -260,6 +260,16 @@ public function setRepository($directory) return $this; } + /** + * Gets the Git repository path + * + * @return string + */ + public function getRepository() + { + return $this->directory; + } + /** * Returns version number *