update-server-info on git pushes and forks
authorChristian Weiske <cweiske@cweiske.de>
Mon, 7 Jul 2014 06:31:51 +0000 (08:31 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Mon, 7 Jul 2014 06:31:51 +0000 (08:31 +0200)
src/phorkie/Forker.php
src/phorkie/Repository/Post.php
src/phorkie/Repository/Setup.php

index b4ab449..da545a7 100644 (file)
@@ -81,6 +81,10 @@ class Forker
         $rs = new Repository_Setup($new);
         $rs->afterInit();
 
+        //update info for dumb git HTTP transport
+        //the post-update hook should do that IMO, but does not somehow
+        $vc->getCommand('update-server-info')->execute();
+
         return $new;
     }
 
index cf07b73..5a450b1 100644 (file)
@@ -152,6 +152,7 @@ class Repository_Post
                 ->setOption('message', "$notes")
                 ->execute();
             //update info for dumb git HTTP transport
+            //the post-update hook should do that IMO, but does not somehow
             $vc->getCommand('update-server-info')->execute();
 
             $bChanged = true;
index f5c9730..cc2fb28 100644 (file)
@@ -27,6 +27,19 @@ class Repository_Setup
 
         $vc = $this->repo->getVc();
 
+        file_put_contents(
+            $this->repo->gitDir . '/hooks/post-update',
+            <<<CDE
+#!/bin/sh
+# Hook script to prepare a packed repository for use over dumb transports.
+
+echo foo > /tmp/foo
+exec git update-server-info
+
+CDE
+        );
+        chmod($this->repo->gitDir . '/hooks/post-update', 0755);
+
         //keep track of owner
         $vc->getCommand('config')
             ->addArgument('owner.name')