1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-29 00:40:57 +01:00

Read arc aliases from all available configuration files

Summary: Fixes T10431. Updates the getAliases() method to read every `arc` configuration file.

Test Plan:
Added an `arc duck` alias to `/etc/arcconfig`, ran `arc duck`, saw "quack".

Added an `arc pig` alias to `~/.arcrc` via `arc alias`, ran `arc pig`, saw "oink oink".

Reviewers: nevogd, chad, #blessed_reviewers

Reviewed By: chad, #blessed_reviewers

Subscribers: eadler, epriestley

Tags: #twitter

Maniphest Tasks: T10431

Differential Revision: https://secure.phabricator.com/D15342
This commit is contained in:
epriestley 2016-06-06 12:34:02 -07:00
parent 19608cffe6
commit 7891df6f25
2 changed files with 17 additions and 10 deletions

View file

@ -100,7 +100,17 @@ final class ArcanistConfigurationManager extends Phobject {
}
$user_config = $this->readUserArcConfig();
$pval = idx($user_config, $key);
// For "aliases" coming from the user config file specifically, read the
// top level "aliases" key instead of the "aliases" key inside the "config"
// setting. Aliases were originally user-specific but later became standard
// configuration, which is why this works oddly.
if ($key === 'aliases') {
$pval = idx($this->readUserConfigurationFile(), $key);
} else {
$pval = idx($user_config, $key);
}
if ($pval !== null) {
$results[self::CONFIG_SOURCE_USER] =
$settings->willReadValue($key, $pval);

View file

@ -59,17 +59,14 @@ EOTEXT
public static function getAliases(
ArcanistConfigurationManager $configuration_manager) {
$sources = $configuration_manager->getConfigFromAllSources('aliases');
$working_copy_config_aliases =
$configuration_manager->getProjectConfig('aliases');
if (!$working_copy_config_aliases) {
$working_copy_config_aliases = array();
$aliases = array();
foreach ($sources as $source) {
$aliases += $source;
}
$user_config_aliases = idx(
$configuration_manager->readUserConfigurationFile(),
'aliases',
array());
return $user_config_aliases + $working_copy_config_aliases;
return $aliases;
}
private function writeAliases(array $aliases) {