From 9e9f228abdf3f10d369b2699ffef29b59ff2bbf4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 3 Apr 2012 22:27:31 +0200 Subject: show public and private git urls if configured --- data/config.php.dist | 4 +++- data/templates/display.htm | 21 +++++++++++++++++++++ src/phorkie/Repository.php | 8 ++++++++ src/phorkie/Repository/Post.php | 4 ++++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/data/config.php.dist b/data/config.php.dist index b213e85..8ef80e9 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -1,3 +1,5 @@ diff --git a/data/templates/display.htm b/data/templates/display.htm index f9ab2e5..da75cd9 100644 --- a/data/templates/display.htm +++ b/data/templates/display.htm @@ -23,6 +23,27 @@ +{% if repo.getCloneURL(true) or repo.getCloneURL(false) %} +
+ {% if repo.getCloneURL(true) %} +
+
Public clone URL
+ +
+ {% endif %} + {% if repo.getCloneURL(false) %} +
+
Private clone URL
+ +
+ {% endif %} +
+{% endif %} + {% for file in repo.getFiles %}
diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index fef5656..6dec015 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -152,6 +152,14 @@ class Repository throw new Exception('Unknown link type'); } + public function getCloneURL($public = true) + { + $var = $public ? 'public' : 'private'; + if (isset($GLOBALS['phorkie']['cfg']['git'][$var])) { + return $GLOBALS['phorkie']['cfg']['git'][$var] . $this->id . '/.git'; + } + return null; + } } ?> diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index 627aa1f..828dbad 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -87,9 +87,13 @@ class Repository_Post $repo = $rs->createNew(); $vc = $repo->getVc(); $vc->initRepository(); + foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) { unlink($hookfile); } + + touch($repo->repoDir . '/.git/git-daemon-export-ok'); + return $repo; } -- cgit v1.2.3