fix: ASW-167 解决本地仓库 切换main分支 报错问题

This commit is contained in:
shizhendong
2024-11-14 17:22:51 +08:00
parent 2db15d0f4e
commit 81d58ae868
2 changed files with 4 additions and 3 deletions

View File

@@ -254,8 +254,9 @@ public class ApplicationMergeServiceImpl extends ServiceImpl<ApplicationMergeDao
// merge
try {
String commitId = gitService.mergeBranch(workspaceId, srcBranch, tgtBranch, message, null);
entity.setEndCommitId(commitId);
gitService.mergeBranch(workspaceId, srcBranch, tgtBranch, message, null);
String latestCommitId = gitService.getLatestCommitId(workspaceId, srcBranch);
entity.setEndCommitId(latestCommitId);
entity.setStatus(MergeRequestStatus.MERGED.toString());
} catch (Exception e) {
log.error(e, "[newMr] [merge error] [workspaceId: {}] [srcBranch: {}] [tgtBranch: {}] [msg: {}]", workspaceId, srcBranch, tgtBranch, e.getMessage());

View File

@@ -477,7 +477,7 @@ public class GitServiceImpl implements IGitService {
// checout
git.checkout()
.setCreateBranch(true)
.setCreateBranch(T.StrUtil.equals("main", tgtBranch) ? false : true)
.setName(tgtBranch)
.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK)
.setStartPoint("origin/" + tgtBranch)