X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/c85fb1700ce938f28da420af9636e246912a996b..52de444faa10f37c4174e9fe2c75e77484342549:/src/phorkie/ForkRemote.php diff --git a/src/phorkie/ForkRemote.php b/src/phorkie/ForkRemote.php index 524255a..d2b077b 100644 --- a/src/phorkie/ForkRemote.php +++ b/src/phorkie/ForkRemote.php @@ -22,7 +22,17 @@ class ForkRemote public function parse() { - $scheme = parse_url($this->url, PHP_URL_SCHEME); + $arUrl = parse_url($this->url); + $scheme = $arUrl['scheme'] ?: ''; + + if ($scheme == 'https' && isset($arUrl['host']) + && $arUrl['host'] == 'gist.github.com' + ) { + $this->arGitUrls[][] = 'git://gist.github.com/' + . ltrim($arUrl['path'], '/') . '.git'; + return true; + } + switch ($scheme) { case 'git': //clearly a git url @@ -105,6 +115,22 @@ class ForkRemote return $this->arGitUrls; } + /** + * Get the URL from which the git URL was derived, often + * the HTTP URL. + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + public function setUrl($url) + { + $this->url = $url; + } + public function isSupported($url) { return parse_url($url, PHP_URL_SCHEME) == 'git';