]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Quote branche names in arc branch
authorslawekbiel <slawekbiel@fb.com>
Thu, 23 Jun 2011 20:28:37 +0000 (13:28 -0700)
committerslawekbiel <slawekbiel@fb.com>
Fri, 24 Jun 2011 02:03:09 +0000 (19:03 -0700)
Summary:
Turns out you can hava a branch named |foo.

(Good that '&& rm -fR /usr' is not a valid name)

Test Plan:
created a branch |test, run arc branch

Reviewed By: epriestley
Reviewers: epriestley, dschafer
CC: aran, epriestley, slawekbiel
Revert Plan:
sure

Other Notes:

Differential Revision: 507

src/repository/api/git/ArcanistGitAPI.php

index b07bc268b1dcfd5978efb09ee08bd27e5080d542..3c466b0da767dbf7fbe35ce0a0371b92e4d5bdf0 100644 (file)
@@ -417,12 +417,12 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI {
       $result[] = $branch;
     }
     $all_names = ipull($result, 'name');
-    $names_list = implode(' ', $all_names);
     // Calling 'git branch' first and then 'git rev-parse' is way faster than
     // 'git branch -v' for some reason.
     list($sha1s_string) = execx(
-      "cd %s && git rev-parse $names_list",
-      $this->path);
+      "cd %s && git rev-parse %Ls",
+      $this->path,
+      $all_names);
     $sha1_map = array_combine($all_names, explode("\n", trim($sha1s_string)));
     foreach ($result as &$branch) {
       $branch['sha1'] = $sha1_map[$branch['name']];
@@ -430,14 +430,6 @@ class ArcanistGitAPI extends ArcanistRepositoryAPI {
     return $result;
   }
 
-  public function multigetRevForBranch($branch_names) {
-    $names_list = implode(' ', $branch_names);
-    list($sha1s_string) = execx(
-      "cd %s && git rev-parse $names_list",
-      $this->path);
-    return array_combine($branch_names, explode("\n", trim($sha1s_string)));
-  }
-
   /**
    * Returns git commit messages for the given revisions,
    * in the specified format (see git show --help for options).