Merge remote-tracking branch 'skl85/hotfix-extautodetect'
[phorkie.git] / src / phorkie / Repository.php
index c854cf167186455fc77049914b2c32212be936de..448982baa2da6c54252731382fd746cc61d832e9 100644 (file)
@@ -176,10 +176,23 @@ class Repository
      */
     public function delete()
     {
+        $db = new Database();
+        $db->getIndexer()->deleteRepo($this);
+
         return Tools::recursiveDelete($this->workDir)
             && Tools::recursiveDelete($this->gitDir);
     }
 
+    public function getTitle()
+    {
+        $desc = $this->getDescription();
+        if (trim($desc) != '') {
+            return $desc;
+        }
+
+        return 'paste #' . $this->id;
+    }
+
     public function getDescription()
     {
         if (!is_readable($this->gitDir . '/description')) {
@@ -269,7 +282,9 @@ class Repository
             $arLineParts = explode(' ', trim($arOutput[$current + 4]));
             $commit->filesChanged = $arLineParts[0];
             $commit->linesAdded   = $arLineParts[3];
-            $commit->linesDeleted = $arLineParts[5];
+            if (isset($arLineParts[5])) {
+                $commit->linesDeleted = $arLineParts[5];
+            }
 
             $current += 6;