1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-28 16:07:11 +00:00

fix set second parent id (#496)

This commit is contained in:
Xiangyue Cai
2021-09-27 16:38:20 +08:00
committed by GitHub
parent 85ead5e00e
commit 4901aefa58

View File

@@ -1639,6 +1639,7 @@ func fastForwardOrMerge(user string, repo *repomgr.Repo, base, newCommit *commit
}
func genCommitNeedRetry(repo *repomgr.Repo, base *commitmgr.Commit, commit *commitmgr.Commit, newRoot, user string, commitID *string) (bool, error) {
var secondParentID string
repoID := repo.ID
var mergeDesc string
var mergedCommit *commitmgr.Commit
@@ -1669,6 +1670,7 @@ func genCommitNeedRetry(repo *repomgr.Repo, base *commitmgr.Commit, commit *comm
}
}
secondParentID = commit.CommitID
mergedCommit = commitmgr.NewCommit(repoID, currentHead.CommitID, opt.mergedRoot, user, mergeDesc)
repomgr.RepoToCommit(repo, mergedCommit)
mergedCommit.SecondParentID.SetValid(commit.CommitID)
@@ -1686,7 +1688,7 @@ func genCommitNeedRetry(repo *repomgr.Repo, base *commitmgr.Commit, commit *comm
mergedCommit = commit
}
err = updateBranch(repoID, mergedCommit.CommitID, currentHead.CommitID, commit.CommitID)
err = updateBranch(repoID, mergedCommit.CommitID, currentHead.CommitID, secondParentID)
if err != nil {
return true, nil
}