preserve symlinks
[pharext/pharext] / src / pharext / SourceDir / Git.php
index df52101b3f043bb9bbd74eba1276c3b4d40409f4..531aa6535f6e29c1b114945e973f8ad819968940 100644 (file)
@@ -47,15 +47,17 @@ class Git implements \IteratorAggregate, SourceDir
                $pwd = getcwd();
                chdir($this->path);
                if (($pipe = popen("git ls-tree -r --name-only HEAD", "r"))) {
+                       $path = realpath($this->path);
                        while (!feof($pipe)) {
                                if (strlen($file = trim(fgets($pipe)))) {
                                        if ($this->cmd->getArgs()->verbose) {
                                                $this->cmd->info("Packaging %s\n", $file);
                                        }
-                                       if (!($realpath = realpath($file))) {
-                                               $this->cmd->error("File %s does not exist\n", $file);
+                                       /* there may be symlinks, so no realpath here */
+                                       if (!file_exists("$path/$file")) {
+                                               $this->cmd->error("File %s does not exist in %s\n", $file, $path);
                                        }
-                                       yield $realpath;
+                                       yield "$path/$file";
                                }
                        }
                        pclose($pipe);