Skip to content

Commit 18ef162

Browse files
committed
fix: un-quote branch names
1 parent 3ba5287 commit 18ef162

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/Version/GitVersionCollection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ public function addFromBranches(Closure|string|null $filter = null): self
145145
)
146146
);
147147

148+
// Git can quote branch names, un-quote them
149+
$branches = array_map(static fn (string $branchName) => str_replace('"', '', $branchName), $branches);
150+
148151
if (null !== $filter && $filter instanceof Closure) {
149152
$branches = array_filter($branches, $filter);
150153
}

tests/Version/GitVersionCollectionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public function testConstructAddVersionFromBranchesWithSorter(): void
500500
'20.0',
501501
'21.0',
502502
'22.0',
503-
'23.0',
503+
'"23.0"',
504504
'3.0',
505505
'3.1',
506506
'3.2',
@@ -519,7 +519,7 @@ public function testConstructAddVersionFromBranchesWithSorter(): void
519519
'9.0',
520520
'HEAD',
521521
'develop',
522-
'gh-pages',
522+
'"gh-pages"',
523523
'hregis-fix_dev_mysql_workbench',
524524
'phpstan-baseline',
525525
'revert-36812-develop_new_force_not_clean_empty_lines',
@@ -605,7 +605,7 @@ public function testConstructAddVersionFromBranchesWithSorterAndGitFilter(): voi
605605
$returnData = implode(
606606
"\n",
607607
[
608-
'10.0',
608+
'"10.0"',
609609
'11.0',
610610
'12.0',
611611
'13.0',
@@ -615,7 +615,7 @@ public function testConstructAddVersionFromBranchesWithSorterAndGitFilter(): voi
615615
'17.0',
616616
'18.0',
617617
'19.0',
618-
'20.0',
618+
'"20.0"',
619619
'21.0',
620620
'22.0',
621621
'23.0',

0 commit comments

Comments
 (0)