From 813d3f5367c15dd21091af6eb7d263e1d98c4c17 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 21 Sep 2012 19:49:51 +0200 Subject: [PATCH] gist.github.com forking support --- src/phorkie/ForkRemote.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/phorkie/ForkRemote.php b/src/phorkie/ForkRemote.php index 524255a..c9ed748 100644 --- a/src/phorkie/ForkRemote.php +++ b/src/phorkie/ForkRemote.php @@ -22,7 +22,15 @@ 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' + ) { + $scheme = 'git'; + $this->url = 'git://gist.github.com/'. ltrim($arUrl['path'], '/') . '.git'; + } + switch ($scheme) { case 'git': //clearly a git url -- 2.30.2