Correct link to branches in github

这个提交包含在:
phl0 2023-01-31 15:15:33 +01:00
父节点 b9b0d0e483
当前提交 f897ec2db3
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A

查看文件

@ -15,11 +15,11 @@
</tr>
<tr>
<td>Language</td>
<td><?php echo ucfirst($this->config->item('language'))."\n"; ?></td>
<td><?php echo $this->config->item('language')."\n"; ?></td>
</tr>
<tr>
<td>Base URL</td>
<td><span id="baseUrl"><a href="<?php echo $this->config->item('base_url')?>" target="_blank"><?php echo $this->config->item('base_url'); ?></a></span> <span data-toggle="tooltip" data-original-title="<?php echo $this->lang->line('copy_to_clipboard'); ?>" onclick='copyURL("<?php echo $this->config->item('base_url'); ?>")'><i class="copy-icon fas fa-copy"></span></td>
<td><?php echo $this->config->item('base_url')."\n"; ?></td>
</tr>
</table>
</div>
@ -163,7 +163,17 @@
<?php
$commitHash = trim(exec('git log --pretty="%H" -n1 HEAD'));
$commitDate = trim(exec('git log --pretty="%ci" -n1 HEAD'));
$branch = trim(exec('git branch --show-current'));
$line = trim(exec('git log -n 1 --pretty=%D HEAD'));
$pieces = explode(', ', $line);
$remote = substr($pieces[1], 0, strpos($pieces[1], '/'));
$branch = substr($pieces[1], strpos($pieces[1], '/')+1);
$url = trim(exec('git remote get-url '.$remote));
$owner = '';
if (strpos($url, 'https://github.com') !== false) {
$owner = preg_replace('/https:\/\/github\.com\/(\w+)\/Cloudlog\.git/', '$1', $url);
} else if (strpos($url, 'git@github.com') !== false) {
$owner = preg_replace('/git@github\.com:(\w+)\/Cloudlog\.git/', '$1', $url);
}
$tag = trim(exec('git describe --tags '.$commitHash));
?>
<div class="card-header">Git Information</div>
@ -173,7 +183,13 @@
<td>Branch</td>
<td>
<?php if($branch != "") { ?>
<a target="_blank" href="https://github.com/magicbug/Cloudlog/tree/<?php echo $branch?>"><span class="badge badge-success"><?php echo $branch; ?></span></a>
<?php if($owner != "") { ?>
<a target="_blank" href="https://github.com/<?php echo $owner; ?>/Cloudlog/tree/<?php echo $branch?>">
<?php } ?>
<span class="badge badge-success"><?php echo $branch; ?></span>
<?php if($owner != "") { ?>
</a>
<?php } ?>
<?php } else { ?>
<span class="badge badge-danger">n/a</span>
<?php } ?>