Skip to content

Commit 698f8d7

Browse files
authored
Merge branch 'main' into lunny/fix_cron_lfs-gc
2 parents 3655f82 + becd15f commit 698f8d7

File tree

18 files changed

+648
-176
lines changed

18 files changed

+648
-176
lines changed

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ a1012112796 <[email protected]> (@a1012112796)
3636
Karl Heinz Marbaise <[email protected]> (@khmarbaise)
3737
Norwin Roosen <[email protected]> (@noerw)
3838
Kyle Dumont <[email protected]> (@kdumontnu)
39-
Patrick Schratz <[email protected]> (@pat-s)
4039
Janis Estelmann <[email protected]> (@KN4CK3R)
41-
Steven Kriegler <[email protected]> (@justusbunsi)
4240
Jimmy Praet <[email protected]> (@jpraet)
4341
Leon Hofmeister <[email protected]> (@delvh)
4442
Wim <[email protected]> (@42wim)

options/locale/locale_en-US.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ path = Path
269269
sqlite_helper = File path for the SQLite3 database.<br>Enter an absolute path if you run Gitea as a service.
270270
reinstall_error = You are trying to install into an existing Gitea database
271271
reinstall_confirm_message = Re-installing with an existing Gitea database can cause multiple problems. In most cases, you should use your existing "app.ini" to run Gitea. If you know what you are doing, confirm the following:
272-
reinstall_confirm_check_1 = The data encrypted by the SECRET_KEY in app.ini may be lost: users may not be able to log in with 2FA/OTP and mirrors may not function correctly. By checking this box, you confirm that the current app.ini file contains the correct the SECRET_KEY.
272+
reinstall_confirm_check_1 = The data encrypted by the SECRET_KEY in app.ini may be lost: users may not be able to log in with 2FA/OTP and mirrors may not function correctly. By checking this box, you confirm that the current app.ini file contains the correct SECRET_KEY.
273273
reinstall_confirm_check_2 = The repositories and settings may need to be resynchronized. By checking this box, you confirm that you will resynchronize the hooks for the repositories and authorized_keys file manually. You confirm that you will ensure that repository and mirror settings are correct.
274274
reinstall_confirm_check_3 = You confirm that you are absolutely sure that this Gitea is running with the correct app.ini location and that you are sure that you have to re-install. You confirm that you acknowledge the above risks.
275275
err_empty_db_path = The SQLite3 database path cannot be empty.
@@ -1322,6 +1322,7 @@ commit_graph.color = Color
13221322
commit.contained_in = This commit is contained in:
13231323
commit.contained_in_default_branch = This commit is part of the default branch
13241324
commit.load_referencing_branches_and_tags = Load branches and tags referencing this commit
1325+
commit.merged_in_pr = This commit was merged in pull request %s.
13251326
blame = Blame
13261327
download_file = Download file
13271328
normal_view = Normal View
@@ -3253,7 +3254,7 @@ auths.oauth2_required_claim_name_helper = Set this name to restrict login from t
32533254
auths.oauth2_required_claim_value = Required Claim Value
32543255
auths.oauth2_required_claim_value_helper = Set this value to restrict login from this source to users with a claim with this name and value
32553256
auths.oauth2_group_claim_name = Claim name providing group names for this source. (Optional)
3256-
auths.oauth2_full_name_claim_name = Full Name Claim Name. (Optional; if set, the user's full name will always be synchronized with this claim)
3257+
auths.oauth2_full_name_claim_name = Full Name Claim Name. (Optional if set, the user's full name will always be synchronized with this claim)
32573258
auths.oauth2_ssh_public_key_claim_name = SSH Public Key Claim Name
32583259
auths.oauth2_admin_group = Group Claim value for administrator users. (Optional — requires claim name above)
32593260
auths.oauth2_restricted_group = Group Claim value for restricted users. (Optional — requires claim name above)

options/locale/locale_fr-FR.ini

Lines changed: 188 additions & 2 deletions
Large diffs are not rendered by default.

options/locale/locale_ga-IE.ini

Lines changed: 118 additions & 0 deletions
Large diffs are not rendered by default.

options/locale/locale_ja-JP.ini

Lines changed: 80 additions & 8 deletions
Large diffs are not rendered by default.

routers/api/v1/repo/action.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,18 +1132,23 @@ func GetWorkflowRun(ctx *context.APIContext) {
11321132
// "$ref": "#/responses/notFound"
11331133

11341134
runID := ctx.PathParamInt64("run")
1135-
job, _, err := db.GetByID[actions_model.ActionRun](ctx, runID)
1135+
job, has, err := db.GetByID[actions_model.ActionRun](ctx, runID)
1136+
if err != nil {
1137+
ctx.APIErrorInternal(err)
1138+
return
1139+
}
11361140

1137-
if err != nil || job.RepoID != ctx.Repo.Repository.ID {
1138-
ctx.APIError(http.StatusNotFound, util.ErrNotExist)
1141+
if !has || job.RepoID != ctx.Repo.Repository.ID {
1142+
ctx.APIErrorNotFound(util.ErrNotExist)
1143+
return
11391144
}
11401145

1141-
convertedArtifact, err := convert.ToActionWorkflowRun(ctx, ctx.Repo.Repository, job)
1146+
convertedRun, err := convert.ToActionWorkflowRun(ctx, ctx.Repo.Repository, job)
11421147
if err != nil {
11431148
ctx.APIErrorInternal(err)
11441149
return
11451150
}
1146-
ctx.JSON(http.StatusOK, convertedArtifact)
1151+
ctx.JSON(http.StatusOK, convertedRun)
11471152
}
11481153

11491154
// ListWorkflowRunJobs Lists all jobs for a workflow run.
@@ -1237,10 +1242,15 @@ func GetWorkflowJob(ctx *context.APIContext) {
12371242
// "$ref": "#/responses/notFound"
12381243

12391244
jobID := ctx.PathParamInt64("job_id")
1240-
job, _, err := db.GetByID[actions_model.ActionRunJob](ctx, jobID)
1245+
job, has, err := db.GetByID[actions_model.ActionRunJob](ctx, jobID)
1246+
if err != nil {
1247+
ctx.APIErrorInternal(err)
1248+
return
1249+
}
12411250

1242-
if err != nil || job.RepoID != ctx.Repo.Repository.ID {
1243-
ctx.APIError(http.StatusNotFound, util.ErrNotExist)
1251+
if !has || job.RepoID != ctx.Repo.Repository.ID {
1252+
ctx.APIErrorNotFound(util.ErrNotExist)
1253+
return
12441254
}
12451255

12461256
convertedWorkflowJob, err := convert.ToActionWorkflowJob(ctx, ctx.Repo.Repository, nil, job)
@@ -1251,7 +1261,7 @@ func GetWorkflowJob(ctx *context.APIContext) {
12511261
ctx.JSON(http.StatusOK, convertedWorkflowJob)
12521262
}
12531263

1254-
// GetArtifacts Lists all artifacts for a repository.
1264+
// GetArtifactsOfRun Lists all artifacts for a repository.
12551265
func GetArtifactsOfRun(ctx *context.APIContext) {
12561266
// swagger:operation GET /repos/{owner}/{repo}/actions/runs/{run}/artifacts repository getArtifactsOfRun
12571267
// ---
@@ -1354,7 +1364,7 @@ func DeleteActionRun(ctx *context.APIContext) {
13541364
runID := ctx.PathParamInt64("run")
13551365
run, err := actions_model.GetRunByRepoAndID(ctx, ctx.Repo.Repository.ID, runID)
13561366
if errors.Is(err, util.ErrNotExist) {
1357-
ctx.APIError(http.StatusNotFound, err)
1367+
ctx.APIErrorNotFound(err)
13581368
return
13591369
} else if err != nil {
13601370
ctx.APIErrorInternal(err)

routers/api/v1/repo/repo.go

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -772,13 +772,8 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
772772
var units []repo_model.RepoUnit
773773
var deleteUnitTypes []unit_model.Type
774774

775-
currHasIssues := repo.UnitEnabled(ctx, unit_model.TypeIssues)
776-
newHasIssues := currHasIssues
777775
if opts.HasIssues != nil {
778-
newHasIssues = *opts.HasIssues
779-
}
780-
if currHasIssues || newHasIssues {
781-
if newHasIssues && opts.ExternalTracker != nil && !unit_model.TypeExternalTracker.UnitGlobalDisabled() {
776+
if *opts.HasIssues && opts.ExternalTracker != nil && !unit_model.TypeExternalTracker.UnitGlobalDisabled() {
782777
// Check that values are valid
783778
if !validation.IsValidExternalURL(opts.ExternalTracker.ExternalTrackerURL) {
784779
err := errors.New("External tracker URL not valid")
@@ -802,7 +797,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
802797
},
803798
})
804799
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeIssues)
805-
} else if newHasIssues && opts.ExternalTracker == nil && !unit_model.TypeIssues.UnitGlobalDisabled() {
800+
} else if *opts.HasIssues && opts.ExternalTracker == nil && !unit_model.TypeIssues.UnitGlobalDisabled() {
806801
// Default to built-in tracker
807802
var config *repo_model.IssuesConfig
808803

@@ -829,7 +824,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
829824
Config: config,
830825
})
831826
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalTracker)
832-
} else if !newHasIssues {
827+
} else if !*opts.HasIssues {
833828
if !unit_model.TypeExternalTracker.UnitGlobalDisabled() {
834829
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalTracker)
835830
}
@@ -839,13 +834,8 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
839834
}
840835
}
841836

842-
currHasWiki := repo.UnitEnabled(ctx, unit_model.TypeWiki)
843-
newHasWiki := currHasWiki
844837
if opts.HasWiki != nil {
845-
newHasWiki = *opts.HasWiki
846-
}
847-
if currHasWiki || newHasWiki {
848-
if newHasWiki && opts.ExternalWiki != nil && !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
838+
if *opts.HasWiki && opts.ExternalWiki != nil && !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
849839
// Check that values are valid
850840
if !validation.IsValidExternalURL(opts.ExternalWiki.ExternalWikiURL) {
851841
err := errors.New("External wiki URL not valid")
@@ -861,15 +851,15 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
861851
},
862852
})
863853
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeWiki)
864-
} else if newHasWiki && opts.ExternalWiki == nil && !unit_model.TypeWiki.UnitGlobalDisabled() {
854+
} else if *opts.HasWiki && opts.ExternalWiki == nil && !unit_model.TypeWiki.UnitGlobalDisabled() {
865855
config := &repo_model.UnitConfig{}
866856
units = append(units, repo_model.RepoUnit{
867857
RepoID: repo.ID,
868858
Type: unit_model.TypeWiki,
869859
Config: config,
870860
})
871861
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalWiki)
872-
} else if !newHasWiki {
862+
} else if !*opts.HasWiki {
873863
if !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
874864
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalWiki)
875865
}
@@ -879,13 +869,8 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
879869
}
880870
}
881871

882-
currHasPullRequests := repo.UnitEnabled(ctx, unit_model.TypePullRequests)
883-
newHasPullRequests := currHasPullRequests
884-
if opts.HasPullRequests != nil {
885-
newHasPullRequests = *opts.HasPullRequests
886-
}
887-
if currHasPullRequests || newHasPullRequests {
888-
if newHasPullRequests && !unit_model.TypePullRequests.UnitGlobalDisabled() {
872+
if opts.HasPullRequests != nil && !unit_model.TypePullRequests.UnitGlobalDisabled() {
873+
if *opts.HasPullRequests {
889874
// We do allow setting individual PR settings through the API, so
890875
// we get the config settings and then set them
891876
// if those settings were provided in the opts.
@@ -953,18 +938,13 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
953938
Type: unit_model.TypePullRequests,
954939
Config: config,
955940
})
956-
} else if !newHasPullRequests && !unit_model.TypePullRequests.UnitGlobalDisabled() {
941+
} else {
957942
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
958943
}
959944
}
960945

961-
currHasProjects := repo.UnitEnabled(ctx, unit_model.TypeProjects)
962-
newHasProjects := currHasProjects
963-
if opts.HasProjects != nil {
964-
newHasProjects = *opts.HasProjects
965-
}
966-
if currHasProjects || newHasProjects {
967-
if newHasProjects && !unit_model.TypeProjects.UnitGlobalDisabled() {
946+
if opts.HasProjects != nil && !unit_model.TypeProjects.UnitGlobalDisabled() {
947+
if *opts.HasProjects {
968948
unit, err := repo.GetUnit(ctx, unit_model.TypeProjects)
969949
var config *repo_model.ProjectsConfig
970950
if err != nil {
@@ -984,7 +964,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
984964
Type: unit_model.TypeProjects,
985965
Config: config,
986966
})
987-
} else if !newHasProjects && !unit_model.TypeProjects.UnitGlobalDisabled() {
967+
} else {
988968
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeProjects)
989969
}
990970
}

routers/web/repo/commit.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
asymkey_model "code.gitea.io/gitea/models/asymkey"
1616
"code.gitea.io/gitea/models/db"
1717
git_model "code.gitea.io/gitea/models/git"
18+
issues_model "code.gitea.io/gitea/models/issues"
1819
"code.gitea.io/gitea/models/renderhelper"
1920
repo_model "code.gitea.io/gitea/models/repo"
2021
unit_model "code.gitea.io/gitea/models/unit"
@@ -411,6 +412,11 @@ func Diff(ctx *context.Context) {
411412
}
412413
}
413414

415+
pr, _ := issues_model.GetPullRequestByMergedCommit(ctx, ctx.Repo.Repository.ID, commitID)
416+
if pr != nil {
417+
ctx.Data["MergedPRIssueNumber"] = pr.Index
418+
}
419+
414420
ctx.HTML(http.StatusOK, tplCommitPage)
415421
}
416422

0 commit comments

Comments
 (0)