From 8b9ff4dad9fce9d200bdeb839610a9da78908548 Mon Sep 17 00:00:00 2001 From: wangxiaodong <645775992@qq.com> Date: Tue, 14 Nov 2023 09:52:42 +0800 Subject: [PATCH] - --- fix/gitlab_fix_main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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)