新增:创建分支已存在分支提示

This commit is contained in:
yystopf 2023-12-14 16:45:02 +08:00
parent 129970a525
commit c75953d343
1 changed files with 5 additions and 1 deletions

View File

@ -59,7 +59,11 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService
if @body[:new_branch].present? && (@body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*'))
error("不合法的分支名称!")
else
error("#{filepath}文件已存在,不能重复创建!")
if json_parse!(body)["message"].present? && json_parse!(body)["message"].starts_with?("branch already exists")
error("#{@body[:new_branch]}分支已存在!")
else
error("#{filepath}文件已存在,不能重复创建!")
end
end
else
Rails.logger.error("Gitea api url==#{url},status:#{status},body=#{body}")