Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Fixes repo

Author Dave Jarvis <email>
Date 2026-02-09 00:11:33 GMT-0800
Commit ac907472709448c74c38e66a6e8e05da802f4e5f
Parent 1cf1195
RepositoryList.php
if (!is_dir($this->rootPath)) return;
- // 1. Scan for all valid .git directories first
$found = [];
$glob = glob($this->rootPath . '/*.git');
- if ($glob !== false) {
+ if ($glob) {
foreach ($glob as $path) {
if (is_dir($path)) {
$name = basename($path, '.git');
$found[$name] = [
'path' => $path,
- 'name' => urldecode($name), // rudimentary decoding
+ 'name' => urldecode($name),
'safe_name' => $name
];
}
}
}
- // 2. Parse order.txt
$orderFile = $this->rootPath . '/order.txt';
$sortMap = [];
$hidden = [];
if (file_exists($orderFile)) {
$lines = file($orderFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $index => $line) {
- // Clean up artifacts (e.g. "")
$line = trim(preg_replace('/^\\s*/', '', $line));
if (empty($line)) continue;
$isHidden = ($line[0] === '-');
$cleanName = basename($isHidden ? substr($line, 1) : $line, '.git');
if ($isHidden) {
$hidden[$cleanName] = true;
} else {
- // Keep track of the explicit order index
$sortMap[$cleanName] = $index;
}
}
}
- // 3. Filter hidden repositories
$visibleRepos = array_filter($found, function($repo) use ($hidden) {
return !isset($hidden[$repo['safe_name']]);
});
- // 4. Sort: Explicit order first, then alphabetical for the rest
uasort($visibleRepos, function($a, $b) use ($sortMap) {
$idxA = $sortMap[$a['safe_name']] ?? PHP_INT_MAX;
});
- // 5. Execute callback
foreach ($visibleRepos as $repo) {
$callback($repo);
Router.php
$hash = $this->sanitizePath($_GET['hash'] ?? '');
- // Find the specific repository object
$currentRepo = null;
$decoded = urldecode($reqRepo);
$git = new Git($currentRepo['path']);
- // Handle multimedia/downloads
if ($action === 'raw') {
return new RawPage($git, $hash);
Delta 2 lines added, 11 lines removed, 9-line decrease