aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Repository/Setup.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/phorkie/Repository/Setup.php')
-rw-r--r--src/phorkie/Repository/Setup.php31
1 files changed, 31 insertions, 0 deletions
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');
+ }
+
+}
+
+?>