diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-04-03 22:27:31 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-04-03 22:27:31 +0200 |
| commit | 9e9f228abdf3f10d369b2699ffef29b59ff2bbf4 (patch) | |
| tree | db79e8144c1271b2c767705a5fb098c1fae14dde | |
| parent | a760f8955d0a4753eb48a7be5f5b242ca3b3f287 (diff) | |
| download | phorkie-9e9f228abdf3f10d369b2699ffef29b59ff2bbf4.tar.gz phorkie-9e9f228abdf3f10d369b2699ffef29b59ff2bbf4.zip | |
show public and private git urls if configured
| -rw-r--r-- | data/config.php.dist | 4 | ||||
| -rw-r--r-- | data/templates/display.htm | 21 | ||||
| -rw-r--r-- | src/phorkie/Repository.php | 8 | ||||
| -rw-r--r-- | src/phorkie/Repository/Post.php | 4 |
4 files changed, 36 insertions, 1 deletions
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 @@ <?php -//$GLOBALS['phorkie']['cfg']['repos'] = '/var/data/phorkie/'; +//$GLOBALS['phorkie']['cfg']['repos'] = '/var/cache/git/paste/'; +//$GLOBALS['phorkie']['cfg']['git']['public'] = 'git://bogo/git/paste/'; +//$GLOBALS['phorkie']['cfg']['git']['private'] = 'ssh://git@bogo:paste/'; ?> 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 @@ </div> </div> +{% if repo.getCloneURL(true) or repo.getCloneURL(false) %} +<div class="well"> + {% if repo.getCloneURL(true) %} + <div class="row-fluid"> + <div class="span3">Public clone URL</div> + <div class="span9"> + <a href="{{repo.getCloneURL(true)}}">{{repo.getCloneURL(true)}}</a> + </div> + </div> + {% endif %} + {% if repo.getCloneURL(false) %} + <div class="row-fluid"> + <div class="span3">Private clone URL</div> + <div class="span9"> + <a href="{{repo.getCloneURL(false)}}">{{repo.getCloneURL(false)}}</a> + </div> + </div> + {% endif %} +</div> +{% endif %} + {% for file in repo.getFiles %} <div class="file"> <div class="header"> 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; } |
