Page MenuHomePhorge

D25148.1734730455.diff
No OneTemporary

D25148.1734730455.diff

diff --git a/src/applications/config/controller/PhabricatorConfigConsoleController.php b/src/applications/config/controller/PhabricatorConfigConsoleController.php
--- a/src/applications/config/controller/PhabricatorConfigConsoleController.php
+++ b/src/applications/config/controller/PhabricatorConfigConsoleController.php
@@ -189,8 +189,13 @@
foreach ($specs as $lib) {
$remote_future = $remote_futures[$lib];
- list($err, $stdout) = $remote_future->resolve();
- if ($err) {
+ try {
+ list($stdout, $err) = $remote_future->resolvex();
+ } catch (CommandException $e) {
+
+ // Better to report git errors than just ignoring them.
+ self::logGitErrorWithPotentialTips($e, $lib);
+
// If this fails for whatever reason, just move on.
continue;
}
@@ -258,13 +263,17 @@
$results = array();
foreach ($log_futures as $lib => $future) {
- list($err, $stdout) = $future->resolve();
- if (!$err) {
+
+ try {
+ list($stdout, $err) = $future->resolvex();
list($hash, $epoch) = explode(' ', $stdout);
- } else {
+ } catch (CommandException $e) {
$hash = null;
$epoch = null;
- }
+
+ // Better to report git errors than just ignoring them.
+ self::logGitErrorWithPotentialTips($e, $lib);
+ }
$result = array(
'hash' => $hash,
@@ -275,7 +284,7 @@
$upstream_future = idx($upstream_futures, $lib);
if ($upstream_future) {
- list($err, $stdout) = $upstream_future->resolve();
+ list($stdout, $err) = $upstream_future->resolve();
if (!$err) {
$branchpoint = trim($stdout);
if (strlen($branchpoint)) {
@@ -340,5 +349,35 @@
->appendChild($table_view);
}
+ /**
+ * Help in better troubleshooting of git dubious ownership
+ * https://we.phorge.it/T15282
+ * @param CommandException $e Exception
+ * @param string $lib Library name involved
+ */
+ private static function logGitErrorWithPotentialTips($e, $lib) {
+
+ // Then, let's try to detect this specific damn error message
+ $expected_error_msg_part = 'detected dubious ownership in repository';
+
+ $stderr = $e->getStderr();
+ if (strpos($stderr, $expected_error_msg_part) !== false) {
+
+ // Try to show a specific error with a resolution
+
+ // show the nice root name
+ $root = dirname(phutil_get_library_root($lib));
+
+ phlog(pht(
+ "Cannot identify the version of the %s repository ".
+ "because the webserver does not trust it.\n".
+ "Try this system resolution:\n".
+ "sudo git config --system --add safe.directory %s", $lib, $root));
+ } else {
+
+ // Otherwise show a generic error message
+ phlog($e);
+ }
+ }
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 21:34 (14 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1018750
Default Alt Text
D25148.1734730455.diff (2 KB)

Event Timeline