Browse Source

Add support for local paths pointing directly at the .git folder instead of actual repo, refs #3338

Jordi Boggiano 9 years ago
parent
commit
766c45c047
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/Composer/Repository/Vcs/GitDriver.php

+ 2 - 1
src/Composer/Repository/Vcs/GitDriver.php

@@ -38,6 +38,7 @@ class GitDriver extends VcsDriver
     public function initialize()
     {
         if (Filesystem::isLocalPath($this->url)) {
+            $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
             $this->repoDir = $this->url;
             $cacheUrl = realpath($this->url);
         } else {
@@ -219,7 +220,7 @@ class GitDriver extends VcsDriver
      */
     public static function supports(IOInterface $io, Config $config, $url, $deep = false)
     {
-        if (preg_match('#(^git://|\.git$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
+        if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
             return true;
         }