]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix an issue with "arc nrabch"
authorepriestley <git@epriestley.com>
Tue, 15 Sep 2015 18:14:07 +0000 (11:14 -0700)
committerepriestley <git@epriestley.com>
Tue, 15 Sep 2015 18:14:07 +0000 (11:14 -0700)
Summary:
Fixes a minor issue from D14034. PHP doesn't like `clone null;`, and if you type a nonsense command like `arc nbrhch` (as I frequently do) we try to `clone null` here.

Instead, just `return null;` if no workflow matches. Clone otherwise.

Test Plan:
  - Ran `arc nbrhcanc`
  - Ran `arc branch`

Reviewers: BYK, chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D14112

src/configuration/ArcanistConfiguration.php

index e66b79362121e4a2cacf7c3237573a5373f115e6..8761d8cb9f595fdecf73b565dcddacf8e0c382ea 100644 (file)
@@ -31,7 +31,13 @@ class ArcanistConfiguration extends Phobject {
       $command = 'version';
     }
 
-    return clone idx($this->buildAllWorkflows(), $command);
+    $workflow = idx($this->buildAllWorkflows(), $command);
+
+    if (!$workflow) {
+      return null;
+    }
+
+    return clone $workflow;
   }
 
   public function buildAllWorkflows() {