better error message
authorMichael Wallner <mike@php.net>
Tue, 27 Feb 2018 13:31:45 +0000 (14:31 +0100)
committerMichael Wallner <mike@php.net>
Tue, 27 Feb 2018 13:31:45 +0000 (14:31 +0100)
src/pharext/Packager.php

index a422e972ece90453169560561b84195a6f24817d..23bcdc9999c52906cf6edcf0254789503c84500e 100644 (file)
@@ -3,7 +3,6 @@
 namespace pharext;
 
 use Phar;
-use pharext\Exception;
 
 /**
  * The extension packaging command executed by bin/pharext
@@ -196,9 +195,15 @@ class Packager implements Command
                        $source = $this->download($source);
                        $this->cleanup[] = new Task\Cleanup($source);
                }
-               $source = realpath($source);
-               if (!is_dir($source)) {
-                       $source = $this->extract($source);
+               if (!$real = realpath($source)) {
+                       $error = "Cannot find source '$source'";
+                       if ($this->args->git) {
+                               $error .= "; did you forget to specify --branch for a remote git source?";
+                       }
+                       throw new Exception($error);
+               }
+               if (!is_dir($real)) {
+                       $source = $this->extract($real);
                        $this->cleanup[] = new Task\Cleanup($source);
                        
                        if (!$this->args->git) {