diff --git a/fix/gitlab_fix_main.go b/fix/gitlab_fix_main.go index cde5a9b..505db7b 100644 --- a/fix/gitlab_fix_main.go +++ b/fix/gitlab_fix_main.go @@ -33,13 +33,15 @@ func (t *FixParams) GitlabFix() (PrUrl string, preview []Preview, err error) { if err != nil { return } - exist, existErr := CheckBranchExist(ctx, repoPath, t.Branch) - if existErr != nil && existErr.Error() != "无法获得检测分支" { - err = existErr - return - } - if exist { - defBranch = t.Branch + if defBranch != t.Branch { + exist, existErr := CheckBranchExist(ctx, repoPath, t.Branch) + if existErr != nil && existErr.Error() != "无法获得检测分支" { + err = existErr + return + } + if exist { + defBranch = t.Branch + } } // 设置git邮箱和用户名 _, err = RunGitCommand(ctx, repoPath, "git", "config", "user.email", t.UserEmail)