1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Fix sync fork for consistency (#33147)

Fixes #33145

An integration test could be added.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Chai-Shi
2025-01-10 13:29:55 +08:00
committed by GitHub
parent 189e7409b7
commit e5f3c16587
8 changed files with 308 additions and 13 deletions

View File

@ -1,8 +1,8 @@
{{if and .UpstreamDivergingInfo (or .UpstreamDivergingInfo.BaseIsNewer .UpstreamDivergingInfo.CommitsBehind)}}
{{if and .UpstreamDivergingInfo (or .UpstreamDivergingInfo.BaseHasNewCommits .UpstreamDivergingInfo.CommitsBehind)}}
<div class="ui message flex-text-block">
<div class="tw-flex-1">
{{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.BranchName|PathEscapeSegments)}}
{{$upstreamHtml := HTMLFormat `<a href="%s">%s:%s</a>` $upstreamLink .Repository.BaseRepo.FullName .BranchName}}
{{$upstreamLink := printf "%s/src/branch/%s" .Repository.BaseRepo.Link (.Repository.BaseRepo.DefaultBranch|PathEscapeSegments)}}
{{$upstreamHtml := HTMLFormat `<a href="%s">%s:%s</a>` $upstreamLink .Repository.BaseRepo.FullName .Repository.BaseRepo.DefaultBranch}}
{{if .UpstreamDivergingInfo.CommitsBehind}}
{{ctx.Locale.TrN .UpstreamDivergingInfo.CommitsBehind "repo.pulls.upstream_diverging_prompt_behind_1" "repo.pulls.upstream_diverging_prompt_behind_n" .UpstreamDivergingInfo.CommitsBehind $upstreamHtml}}
{{else}}

View File

@ -10867,6 +10867,52 @@
}
}
},
"/repos/{owner}/{repo}/merge-upstream": {
"post": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Merge a branch from upstream",
"operationId": "repoMergeUpstream",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/MergeUpstreamRequest"
}
}
],
"responses": {
"200": {
"$ref": "#/responses/MergeUpstreamResponse"
},
"400": {
"$ref": "#/responses/error"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/{repo}/milestones": {
"get": {
"produces": [
@ -22827,6 +22873,26 @@
"x-go-name": "MergePullRequestForm",
"x-go-package": "code.gitea.io/gitea/services/forms"
},
"MergeUpstreamRequest": {
"type": "object",
"properties": {
"branch": {
"type": "string",
"x-go-name": "Branch"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"MergeUpstreamResponse": {
"type": "object",
"properties": {
"merge_type": {
"type": "string",
"x-go-name": "MergeStyle"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"MigrateRepoOptions": {
"description": "MigrateRepoOptions options for migrating repository's\nthis is used to interact with api v1",
"type": "object",
@ -26008,6 +26074,18 @@
"type": "string"
}
},
"MergeUpstreamRequest": {
"description": "",
"schema": {
"$ref": "#/definitions/MergeUpstreamRequest"
}
},
"MergeUpstreamResponse": {
"description": "",
"schema": {
"$ref": "#/definitions/MergeUpstreamResponse"
}
},
"Milestone": {
"description": "Milestone",
"schema": {