mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-09 02:09:25 +08: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:
@@ -1062,19 +1062,11 @@ func MergePullRequest(ctx *context.APIContext) {
|
||||
// parseCompareInfo returns non-nil if it succeeds, it always writes to the context and returns nil if it fails
|
||||
func parseCompareInfo(ctx *context.APIContext, compareParam string) (result *git_service.CompareInfo, closer func()) {
|
||||
baseRepo := ctx.Repo.Repository
|
||||
compareReq, err := common.ParseCompareRouterParam(compareParam)
|
||||
switch {
|
||||
case errors.Is(err, util.ErrInvalidArgument):
|
||||
ctx.APIError(http.StatusBadRequest, err.Error())
|
||||
return nil, nil
|
||||
case err != nil:
|
||||
ctx.APIErrorInternal(err)
|
||||
return nil, nil
|
||||
}
|
||||
compareReq := common.ParseCompareRouterParam(compareParam)
|
||||
|
||||
// remove the check when we support compare with carets
|
||||
if compareReq.CaretTimes > 0 {
|
||||
ctx.APIError(http.StatusBadRequest, "Unsupported compare syntax with carets")
|
||||
if compareReq.BaseOriRefSuffix != "" {
|
||||
ctx.APIError(http.StatusBadRequest, "Unsupported comparison syntax: ref with suffix")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user