mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-07 09:49:41 +09:00
improve the compare page (#36261)
- The compare page head title should be `compare` but not `new pull request`. - Use `UnstableGuessRefByShortName` instead of duplicated functions calls. - Direct-compare, tags, commits compare will not display `New Pull Request` button any more. The new screenshot <img width="1459" height="391" alt="image" src="https://github.com/user-attachments/assets/64e9b070-9c0b-41d1-b4b8-233b96270e1b" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -220,3 +220,14 @@ func (ref RefName) RefWebLinkPath() string {
|
||||
}
|
||||
return string(refType) + "/" + util.PathEscapeSegments(ref.ShortName())
|
||||
}
|
||||
|
||||
func ParseRefSuffix(ref string) (string, string) {
|
||||
// Partially support https://git-scm.com/docs/gitrevisions
|
||||
if idx := strings.Index(ref, "@{"); idx != -1 {
|
||||
return ref[:idx], ref[idx:]
|
||||
}
|
||||
if idx := strings.Index(ref, "^"); idx != -1 {
|
||||
return ref[:idx], ref[idx:]
|
||||
}
|
||||
return ref, ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user