| | if (empty($line)) continue; |
| | if (preg_match('/^(\d+)\s+(blob|tree)\s+([a-f0-9]+)\s+(.+)$/', $line, $matches)) { |
| | - $items[] = [ |
| | + $item = [ |
| | 'mode' => $matches[1], |
| | 'type' => $matches[2], |
| | 'hash' => $matches[3], |
| | 'name' => $matches[4] |
| | ]; |
| | + |
| | + // Get size for blobs |
| | + if ($item['type'] === 'blob') { |
| | + $sizeOutput = execGitRaw($repo, "cat-file -s " . escapeshellarg($item['hash'])); |
| | + $item['size'] = (int)trim($sizeOutput); |
| | + } |
| | + |
| | + // Get last modification time for this file |
| | + $filePath = $path ? $path . '/' . $item['name'] : $item['name']; |
| | + $mtimeOutput = execGitRaw($repo, "log -1 --format=%ct " . escapeshellarg($ref) . " -- " . escapeshellarg($filePath)); |
| | + if (!empty($mtimeOutput)) { |
| | + $item['mtime'] = (int)trim($mtimeOutput); |
| | + } |
| | + |
| | + $items[] = $item; |
| | } |
| | } |