Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2681465
D25148.1734642574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25148.1734642574.diff
View Options
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,16 @@
$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 +283,7 @@
$upstream_future = idx($upstream_futures, $lib);
if ($upstream_future) {
- list($err, $stdout) = $upstream_future->resolve();
+ list($stdout, $err) = $upstream_future->resolvex();
if (!$err) {
$branchpoint = trim($stdout);
if (strlen($branchpoint)) {
@@ -340,5 +348,36 @@
->appendChild($table_view);
}
+ /**
+ * Help in better troubleshooting git errors
+ * @param CommandException $e Exception
+ * @param string $lib Library name involved
+ */
+ private static function logGitErrorWithPotentialTips($e, $lib) {
+
+ // First, detect this specific error message related to [safe] stuff.
+ $expected_error_msg_part = 'detected dubious ownership in repository';
+ $stderr = $e->getStderr();
+ if (strpos($stderr, $expected_error_msg_part) !== false) {
+
+ // Found! Let's show a nice resolution tip.
+
+ // Complete path of the problematic repository.
+ $lib_root = dirname(phutil_get_library_root($lib));
+
+ phlog(pht(
+ "Cannot identify the version of the %s repository because ".
+ "the webserver does not trust it (more info on Task %s).\n".
+ "Try this system resolution:\n".
+ "sudo git config --system --add safe.directory %s",
+ $lib,
+ 'https://we.phorge.it/T15282',
+ $lib_root));
+ } else {
+
+ // Otherwise show a generic error message
+ phlog($e);
+ }
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 21:09 (20 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1015621
Default Alt Text
D25148.1734642574.diff (2 KB)
Attached To
Mode
D25148: Config page: add lovely git-related error messages in standard error log
Attached
Detach File
Event Timeline
Log In to Comment