mirror of
https://github.com/go-gitea/gitea
synced 2025-07-26 12:18:36 +00:00
add submodule diff links (#33097)
This adds links to submodules in diffs, similar to the existing link when viewing a repo at a specific commit. It does this by expanding diff parsing to recognize changes to submodules, and find the specific refs that are added, deleted or changed. Related #25888 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -13,15 +13,15 @@
|
||||
<div class="repo-file-item">
|
||||
{{$entry := $item.Entry}}
|
||||
{{$commit := $item.Commit}}
|
||||
{{$subModuleFile := $item.SubModuleFile}}
|
||||
{{$submoduleFile := $item.SubmoduleFile}}
|
||||
<div class="repo-file-cell name {{if not $commit}}notready{{end}}">
|
||||
{{if $entry.IsSubModule}}
|
||||
{{svg "octicon-file-submodule"}}
|
||||
{{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}}
|
||||
{{if $refURL}}
|
||||
<a class="muted" href="{{$refURL}}">{{$entry.Name}}</a> <span class="at">@</span> <a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
|
||||
{{$submoduleLink := $submoduleFile.SubmoduleWebLink ctx}}
|
||||
{{if $submoduleLink}}
|
||||
<a class="muted" href="{{$submoduleLink.RepoWebLink}}">{{$entry.Name}}</a> <span class="at">@</span> <a href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a>
|
||||
{{else}}
|
||||
{{$entry.Name}} <span class="at">@</span> {{ShortSha $subModuleFile.RefID}}
|
||||
{{$entry.Name}} <span class="at">@</span> {{ShortSha $submoduleFile.RefID}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if $entry.IsDir}}
|
||||
|
Reference in New Issue
Block a user