Skip to content

Commit

Permalink
Tweak bitbucket driver to uniformize regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Nov 11, 2021
1 parent ba1814f commit 68847ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Composer/Repository/Vcs/GitBitbucketDriver.php
Expand Up @@ -26,9 +26,9 @@
class GitBitbucketDriver extends VcsDriver
{
/** @var string */
private $owner;
protected $owner;
/** @var string */
private $repository;
protected $repository;
/** @var bool */
private $hasIssues = false;
/** @var ?string */
Expand All @@ -51,7 +51,7 @@ class GitBitbucketDriver extends VcsDriver
/**
* @var ?VcsDriver
*/
private $fallbackDriver = null;
protected $fallbackDriver = null;
/** @var string|null if set either git or hg */
private $vcsType;

Expand All @@ -60,7 +60,7 @@ class GitBitbucketDriver extends VcsDriver
*/
public function initialize()
{
preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';
Expand Down Expand Up @@ -521,7 +521,7 @@ public function getRootIdentifier()
*/
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?$#i', $url)) {
if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)?$#i', $url)) {
return false;
}

Expand Down

0 comments on commit 68847ed

Please sign in to comment.