mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-04-02 23:48:17 +02:00
Fix error behavior of "arc version" when it encounters a library which is not a working copy
Summary: Ref T13504. The API has changed here slightly, and if you run "arc version" without "arcanist/" being a Git working copy, it currently fatals in a misleading way. Instead, reach the error properly. Test Plan: Ran "arc version" after moving aside ".git/", got a helpful error message instead of a confusing "call on null" exception. Maniphest Tasks: T13504 Differential Revision: https://secure.phabricator.com/D21050
This commit is contained in:
parent
63276697eb
commit
5ce1d79717
1 changed files with 14 additions and 6 deletions
|
@ -48,15 +48,23 @@ EOTEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($roots as $lib => $root) {
|
foreach ($roots as $lib => $root) {
|
||||||
$working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root);
|
$is_git = false;
|
||||||
$repository_api = $working_copy->newRepositoryAPI();
|
|
||||||
|
|
||||||
if (!$repository_api instanceof ArcanistGitAPI) {
|
$working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root);
|
||||||
throw new ArcanistUsageException(
|
if ($working_copy) {
|
||||||
|
$repository_api = $working_copy->newRepositoryAPI();
|
||||||
|
if ($repository_api instanceof ArcanistGitAPI) {
|
||||||
|
$is_git = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$is_git) {
|
||||||
|
throw new PhutilArgumentUsageException(
|
||||||
pht(
|
pht(
|
||||||
'Library "%s" is not a Git working copy, so no version '.
|
'Library "%s" (at "%s") is not a Git working copy, so no version '.
|
||||||
'information can be provided.',
|
'information can be provided.',
|
||||||
$lib));
|
$lib,
|
||||||
|
Filesystem::readablePath($root)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Carefully execute these commands in a way that works on Windows
|
// NOTE: Carefully execute these commands in a way that works on Windows
|
||||||
|
|
Loading…
Add table
Reference in a new issue