1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Quote branche names in arc branch

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
This commit is contained in:
slawekbiel 2011-06-23 13:28:37 -07:00
parent 448cd31fff
commit 499d4bd243

View file

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