新增:创建项目auto_init参数

This commit is contained in:
2024-01-31 16:47:00 +08:00
parent d0bc8e4378
commit 447429a663
6 changed files with 15 additions and 8 deletions

View File

@@ -61,7 +61,8 @@ class Projects::CreateService < ApplicationService
{
hidden: !repo_is_public,
user_id: params[:user_id],
identifier: params[:repository_name]
identifier: params[:repository_name],
auto_init: params[:auto_init]
}
end

View File

@@ -67,7 +67,7 @@ class Repositories::CreateService < ApplicationService
end
def repository_params
params.merge(project_id: project.id)
params.merge(project_id: project.id).except(:auto_init)
end
def gitea_repository_params
@@ -75,7 +75,7 @@ class Repositories::CreateService < ApplicationService
name: params[:identifier],
private: params[:hidden],
# readme: "ReadMe",
"auto_init": true,
auto_init: params[:auto_init],
# "description": "string",
# "gitignores": "string",
# "issue_labels": "string",
@@ -89,7 +89,7 @@ class Repositories::CreateService < ApplicationService
license = project.license
hash = hash.merge(license: license.name) if license
hash = hash.merge(gitignores: ignore.name) if ignore
hash = hash.merge(auto_init: true) if ignore || license
hash = hash.merge(auto_init: true) if ignore && license
hash
end
end