Index forks only after their description has been set
authorChristian Weiske <cweiske@cweiske.de>
Sat, 22 Sep 2012 11:35:13 +0000 (13:35 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 22 Sep 2012 11:35:13 +0000 (13:35 +0200)
src/phorkie/Forker.php

index affa12a..c75cb39 100644 (file)
@@ -7,6 +7,7 @@ class Forker
     {
         $new = $this->fork($repo->gitDir);
         \copy($repo->gitDir . '/description', $new->gitDir . '/description');
+        $this->index($new);
         return $new;
     }
 
@@ -17,6 +18,7 @@ class Forker
             $new->gitDir . '/description',
             'Fork of ' . $originalUrl
         );
+        $this->index($new);
         return $new;
     }
 
@@ -38,11 +40,14 @@ class Forker
             \unlink($hookfile);
         }
 
-        $db = new Database();
-        $db->getIndexer()->addRepo($new);
-
         return $new;
     }
+
+    protected function index($repo)
+    {
+        $db = new Database();
+        $db->getIndexer()->addRepo($repo);
+    }
 }
 
 ?>