Check directly with Gerrit to see if repository exists.
diff --git a/commits/repositories.php b/commits/repositories.php
index 97d12be..4a6c59a 100644
--- a/commits/repositories.php
+++ b/commits/repositories.php
@@ -163,18 +163,16 @@
}
function getGerritUrl($path) {
- preg_match('/\/gitroot\/(.+)/', $path, $matches);
+ preg_match('/\/gitroot\/(.+)\.git$/', $path, $matches);
$partial = $matches[1];
$gerrit = "https://git.eclipse.org/r/p/$partial";
- //if (!isValidUrl($gerrit)) return '';
- //$test = exec("git ls-remote $gerrit", $ignore, $result);
- //if ($result) return ''; // Anything other than 0 means error
+
+ // Use the RESTful web service to determine if the repository is
+ // available on Gerrit.
+ $known = preg_split("/\n/", file_get_contents('https://git.eclipse.org/r/projects/'));
+ if (in_array($partial, $known)) return $gerrit;
- $contents = file_get_contents("https://git.eclipse.org/r/#/admin/projects/$partial");
- if (preg_match('/Not Found/', $contents)) return '';
-
- return $gerrit;
-
+ return '';
}
function getGitHubUrl($path) {