aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/Repository/Setup.php
blob: e26338bf9a7656065f2e9696e445ab1b6347bd04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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');
    }

}

?>