From f97aef4bc1218f95b337d157e5264e91b13e2f70 Mon Sep 17 00:00:00 2001 From: Oliver Feige Date: Thu, 29 Dec 2016 16:20:17 +0100 Subject: [PATCH] update regex to support a longer commit-id than 7 characters --- src/PHPGit/Command/BranchCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPGit/Command/BranchCommand.php b/src/PHPGit/Command/BranchCommand.php index 4b42f50..2585656 100644 --- a/src/PHPGit/Command/BranchCommand.php +++ b/src/PHPGit/Command/BranchCommand.php @@ -64,7 +64,7 @@ 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]+) +((?:->) (?<alias>[^\s]+)|(?<hash>[0-9a-f]{4,41}) (?<title>.*))/', $line, $matches); $branch['current'] = ($matches['current'] == '*'); $branch['name'] = $matches['name'];