aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-21 19:49:51 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-21 19:49:51 +0200
commit813d3f5367c15dd21091af6eb7d263e1d98c4c17 (patch)
treea5544fedc94703732e6aa91c6b3a2b385a8a663d
parent6b6b594147ad92e800fbeaa0e3d4162d6268eb9a (diff)
downloadphorkie-813d3f5367c15dd21091af6eb7d263e1d98c4c17.tar.gz
phorkie-813d3f5367c15dd21091af6eb7d263e1d98c4c17.zip
gist.github.com forking support
-rw-r--r--src/phorkie/ForkRemote.php10
1 files changed, 9 insertions, 1 deletions
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