check git version in setupcheck
[phorkie.git] / src / phorkie / File.php
index 3c6c56d7e432912d00c47db9546fd7aed9cc62ee..188c255918f8f0cbb44b983b4a94ac923f7ce274 100644 (file)
@@ -61,7 +61,11 @@ class File
     public function getContent()
     {
         if ($this->repo->hash) {
-            return $this->repo->getVc()->getCommand('show')
+            //quick hack until https://pear.php.net/bugs/bug.php?id=19385 is fixed
+            $cmd = new GitCommandBinary($this->repo->getVc());
+            $cmd->setSubCommand('show');
+            return //$this->repo->getVc()->getCommand('show')
+                $cmd
                 ->addArgument($this->repo->hash . ':' . $this->path)
                 ->execute();
         }
@@ -102,7 +106,12 @@ class File
     public function getLink($type, $option = null)
     {
         if ($type == 'raw') {
-            return '/' . $this->repo->id . '/raw/' . $this->getFilename();
+            if ($this->repo->hash === null) {
+                return '/' . $this->repo->id . '/raw/' . $this->getFilename();
+            } else {
+                return '/' . $this->repo->id . '/rev-raw/' . $this->repo->hash
+                    . '/' . $this->getFilename();
+            }
         } else if ($type == 'tool') {
             return '/' . $this->repo->id . '/tool/' . $option . '/' . $this->getFilename();
         }
@@ -123,6 +132,10 @@ class File
      */
     public function getToolInfos()
     {
+        if ($this->repo->hash !== null) {
+            return array();
+        }
+
         $tm = new Tool_Manager();
         return $tm->getSuitable($this);
     }