| | $this->git->eachTag(function($name, $sha) use ($repoParam, &$hasTags) { |
| | $hasTags = true; |
| | - $url = '?hash=' . $sha . $repoParam; |
| | + |
| | + $filesUrl = '?hash=' . $sha . $repoParam; |
| | + $commitUrl = '?action=commit&hash=' . $sha . $repoParam; |
| | + |
| | + // Parse date from object (Tag or Commit) |
| | + $data = $this->git->read($sha); |
| | + $date = ''; |
| | + |
| | + // Check for 'tagger' (Annotated Tag) |
| | + if (preg_match('/^tagger .* (\d+) [+\-]\d{4}$/m', $data, $matches)) { |
| | + $date = date('Y-m-d', $matches[1]); |
| | + } |
| | + // Fallback to 'author' (Lightweight Tag / Commit) |
| | + elseif (preg_match('/^author .* (\d+) [+\-]\d{4}$/m', $data, $matches)) { |
| | + $date = date('Y-m-d', $matches[1]); |
| | + } |
| | |
| | echo '<div class="ref-item">'; |
| | echo '<span class="ref-type tag">Tag</span>'; |
| | - echo '<a href="' . $url . '" class="ref-name">' . htmlspecialchars($name) . '</a>'; |
| | - echo '<span class="commit-hash" style="margin-left: auto;">' . substr($sha, 0, 7) . '</span>'; |
| | + echo '<a href="' . $filesUrl . '" class="ref-name">' . htmlspecialchars($name) . '</a>'; |
| | + |
| | + if ($date) { |
| | + echo '<span class="commit-date" style="margin-left: auto;">' . $date . '</span>'; |
| | + echo '<a href="' . $commitUrl . '" class="commit-hash">' . substr($sha, 0, 7) . '</a>'; |
| | + } else { |
| | + echo '<a href="' . $commitUrl . '" class="commit-hash" style="margin-left: auto;">' . substr($sha, 0, 7) . '</a>'; |
| | + } |
| | + |
| | echo '</div>'; |
| | }); |
| | |
| | if (!$hasTags) { |
| | echo '<div class="empty-state"><p>No tags found.</p></div>'; |
| | } |
| | |
| | - echo '</div>'; // end refs-list |
| | + echo '</div>'; |
| | }, $this->currentRepo); |
| | } |