aboutsummaryrefslogtreecommitdiffstats
path: root/services/convert/repository.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/convert/repository.go')
-rw-r--r--services/convert/repository.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/services/convert/repository.go b/services/convert/repository.go
index 88ccd88fcf..614eb58a88 100644
--- a/services/convert/repository.go
+++ b/services/convert/repository.go
@@ -14,6 +14,7 @@ import (
unit_model "code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/util"
)
// ToRepo converts a Repository to api.Repository
@@ -33,7 +34,9 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
permissionInRepo.SetUnitsWithDefaultAccessMode(repo.Units, permissionInRepo.AccessMode)
}
- cloneLink := repo.CloneLink()
+ // TODO: ideally we should pass "doer" into "ToRepo" to to make CloneLink could generate user-related links
+ // And passing "doer" in will also fix other FIXMEs in this file.
+ cloneLink := repo.CloneLinkGeneral(ctx) // no doer at the moment
permission := &api.Permission{
Admin: permissionInRepo.AccessMode >= perm.AccessModeAdmin,
Push: permissionInRepo.UnitAccessMode(unit_model.TypeCode) >= perm.AccessModeWrite,
@@ -95,6 +98,8 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
allowSquash := false
allowFastForwardOnly := false
allowRebaseUpdate := false
+ allowManualMerge := true
+ autodetectManualMerge := false
defaultDeleteBranchAfterMerge := false
defaultMergeStyle := repo_model.MergeStyleMerge
defaultAllowMaintainerEdit := false
@@ -108,6 +113,8 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
allowSquash = config.AllowSquash
allowFastForwardOnly = config.AllowFastForwardOnly
allowRebaseUpdate = config.AllowRebaseUpdate
+ allowManualMerge = config.AllowManualMerge
+ autodetectManualMerge = config.AutodetectManualMerge
defaultDeleteBranchAfterMerge = config.DefaultDeleteBranchAfterMerge
defaultMergeStyle = config.GetDefaultMergeStyle()
defaultAllowMaintainerEdit = config.DefaultAllowMaintainerEdit
@@ -232,6 +239,8 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
AllowSquash: allowSquash,
AllowFastForwardOnly: allowFastForwardOnly,
AllowRebaseUpdate: allowRebaseUpdate,
+ AllowManualMerge: allowManualMerge,
+ AutodetectManualMerge: autodetectManualMerge,
DefaultDeleteBranchAfterMerge: defaultDeleteBranchAfterMerge,
DefaultMergeStyle: string(defaultMergeStyle),
DefaultAllowMaintainerEdit: defaultAllowMaintainerEdit,
@@ -240,7 +249,7 @@ func innerToRepo(ctx context.Context, repo *repo_model.Repository, permissionInR
MirrorInterval: mirrorInterval,
MirrorUpdated: mirrorUpdated,
RepoTransfer: transfer,
- Topics: repo.Topics,
+ Topics: util.SliceNilAsEmpty(repo.Topics),
ObjectFormatName: repo.ObjectFormatName,
Licenses: repoLicenses.StringList(),
}