preserve symlinks
authorMichael Wallner <mike@php.net>
Mon, 9 Mar 2015 16:26:28 +0000 (17:26 +0100)
committerMichael Wallner <mike@php.net>
Mon, 9 Mar 2015 16:26:28 +0000 (17:26 +0100)
bin/pharext
src/pharext/SourceDir/Git.php

index 6137e91b8dfd00df99eeb788ad1753f2974c7a65..3ab0aad8cb015fabf0b1ef8017facf4748cc3ad5 100755 (executable)
Binary files a/bin/pharext and b/bin/pharext differ
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);