aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/Forker.php5
-rw-r--r--src/phorkie/Repository/Post.php7
-rw-r--r--src/phorkie/Repository/Setup.php31
3 files changed, 35 insertions, 8 deletions
diff --git a/src/phorkie/Forker.php b/src/phorkie/Forker.php
index 7473f16..157cb5e 100644
--- a/src/phorkie/Forker.php
+++ b/src/phorkie/Forker.php
@@ -48,9 +48,8 @@ class Forker
throw $e;
}
- foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) {
- \unlink($hookfile);
- }
+ $rs = new Repository_Setup($new);
+ $rs->afterInit();
return $new;
}
diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php
index 1a30b47..fe6858b 100644
--- a/src/phorkie/Repository/Post.php
+++ b/src/phorkie/Repository/Post.php
@@ -190,11 +190,8 @@ class Repository_Post
->addArgument($repo->workDir)
->execute();
- foreach (glob($repo->gitDir . '/hooks/*') as $hookfile) {
- unlink($hookfile);
- }
-
- touch($repo->gitDir . '/git-daemon-export-ok');
+ $rs = new Repository_Setup($repo);
+ $rs->afterInit();
return $repo;
}
diff --git a/src/phorkie/Repository/Setup.php b/src/phorkie/Repository/Setup.php
new file mode 100644
index 0000000..e26338b
--- /dev/null
+++ b/src/phorkie/Repository/Setup.php
@@ -0,0 +1,31 @@
+<?php
+namespace phorkie;
+
+class Repository_Setup
+{
+ protected $repo;
+
+ public function __construct(Repository $repo)
+ {
+ $this->repo = $repo;
+ }
+
+ /**
+ * Should be called right after a repository has been created,
+ * either by "git init" or "git clone".
+ * Takes care of removing hook example files and creating
+ * the git daemon export file
+ *
+ * @return void
+ */
+ public function afterInit()
+ {
+ foreach (glob($this->repo->gitDir . '/hooks/*') as $hookfile) {
+ unlink($hookfile);
+ }
+ touch($this->repo->gitDir . '/git-daemon-export-ok');
+ }
+
+}
+
+?>