]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix an issue where 'arc alias' reverses parameters
authorepriestley <git@epriestley.com>
Wed, 8 Aug 2012 19:58:27 +0000 (12:58 -0700)
committerepriestley <git@epriestley.com>
Wed, 8 Aug 2012 19:58:27 +0000 (12:58 -0700)
Summary:
We shove alias parameters onto the front of the arg list so if you make an alias like "qdiff" = "diff x y z" and then run "qdiff a b c", we end up with "diff x y z a b c". However, currently we reverse alias parameters, so you actually get "diff z y x a b c".

This is a problem for `arc alias bdiff -- diff --background 1`, which evaluates to `arc diff 1 --background` and fails.

Test Plan: Created a `bdiff` alias and ran it successfully.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran
Differential Revision: https://secure.phabricator.com/D3196

src/workflow/ArcanistAliasWorkflow.php

index cc71733951a0a497cd84781df898c1743c49b771..8c2c5726bf72f53497993f50c1d2d9b709490446 100644 (file)
@@ -171,7 +171,7 @@ EOTEXT
     }
 
     $alias_argv = array_slice($aliases[$command], 1);
-    foreach ($alias_argv as $alias_arg) {
+    foreach (array_reverse($alias_argv) as $alias_arg) {
       if (!in_array($alias_arg, $argv)) {
         array_unshift($argv, $alias_arg);
       }