Refactor RefName (#33234)

And fix some FIXMEs
This commit is contained in:
wxiaoguang 2025-01-13 14:01:53 +08:00 committed by GitHub
parent 81352542fd
commit 2ea929a952
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 58 additions and 60 deletions

View file

@ -210,16 +210,7 @@ func (r *Repository) GetCommitGraphsCount(ctx context.Context, hidePRRefs bool,
// * "commit/123456"
// It is usually used to construct a link like ".../src/{{RefTypeNameSubURL}}/{{PathEscapeSegments TreePath}}"
func (r *Repository) RefTypeNameSubURL() string {
switch {
case r.IsViewBranch:
return "branch/" + util.PathEscapeSegments(r.BranchName)
case r.IsViewTag:
return "tag/" + util.PathEscapeSegments(r.TagName)
case r.IsViewCommit:
return "commit/" + util.PathEscapeSegments(r.CommitID)
}
log.Error("Unknown view type for repo: %v", r)
return ""
return r.RefFullName.RefWebLinkPath()
}
// GetEditorconfig returns the .editorconfig definition if found in the