Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/structs/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,23 @@ type CreateRepoOption struct {
// Whether the repository is private
Private bool `json:"private"`
// Label-Set to use
IssueLabels string `json:"issue_labels"`
IssueLabels string `json:"issue_labels" binding:"MaxSize(255)"`
// Whether the repository should be auto-initialized?
AutoInit bool `json:"auto_init"`
// Whether the repository is template
Template bool `json:"template"`
// Gitignores to use
Gitignores string `json:"gitignores"`
// License to use
License string `json:"license"`
License string `json:"license" binding:"MaxSize(100)"`
// Readme of the repository to create
Readme string `json:"readme"`
Readme string `json:"readme" binding:"MaxSize(255)"`
// DefaultBranch of the repository (used when initializes and in template)
DefaultBranch string `json:"default_branch" binding:"GitRefName;MaxSize(100)"`
// TrustModel of the repository
// enum: default,collaborator,committer,collaboratorcommitter
TrustModel string `json:"trust_model"`
// ObjectFormatName of the underlying git repository
// ObjectFormatName of the underlying git repository, empty string for default (sha1)
// enum: sha1,sha256
ObjectFormatName string `json:"object_format_name" binding:"MaxSize(6)"`
}
Expand Down
8 changes: 4 additions & 4 deletions services/forms/repo_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ type CreateRepoForm struct {
DefaultBranch string `binding:"GitRefName;MaxSize(100)"`
AutoInit bool
Gitignores string
IssueLabels string
License string
Readme string
IssueLabels string `binding:"MaxSize(255)"`
License string `binding:"MaxSize(100)"`
Readme string `binding:"MaxSize(255)"`
Template bool

RepoTemplate int64
Expand All @@ -41,7 +41,7 @@ type CreateRepoForm struct {
Labels bool
ProtectedBranch bool

ForkSingleBranch string
ForkSingleBranch string `binding:"MaxSize(255)"`
ObjectFormatName string
}

Expand Down
3 changes: 3 additions & 0 deletions services/repository/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ func CreateRepositoryDirectly(ctx context.Context, doer, owner *user_model.User,
if opts.ObjectFormatName == "" {
opts.ObjectFormatName = git.Sha1ObjectFormat.Name()
}
if opts.ObjectFormatName != git.Sha1ObjectFormat.Name() && opts.ObjectFormatName != git.Sha256ObjectFormat.Name() {
return nil, fmt.Errorf("unsupported object format: %s", opts.ObjectFormatName)
}

repo := &repo_model.Repository{
OwnerID: owner.ID,
Expand Down
2 changes: 1 addition & 1 deletion templates/swagger/v1_json.tmpl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.