Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2023-02-14 07:34:37 +0300
committerJohn Cai <jcai@gitlab.com>2023-02-16 07:40:07 +0300
commit21ae016638a636689d5343be87cf42c33b6d5996 (patch)
tree92e3e05eb0b1c00b34a12c9822fce55c6e50a62a /internal
parent85a97c985f990b037be757aad7027b29ceaa2732 (diff)
operations: Allow unrelated histories in UserMergeBranch
UserMergeBranch will receive requests to merge commits with unrelated histories. This commit allows that in the RPC. 7188fee10 (2023-11-15: operations: Implement merge() using git-merge-tree(1)) modified the `TestUserMergeBranch_conflict` test to add a common ancestor. This was incorrect, as we should not have modified existing tests to match the new implementation. This commit restores the original test before 7188fee10 so the two commits being merged do not share a common ancestor.
Diffstat (limited to 'internal')
-rw-r--r--internal/gitaly/service/operations/merge.go2
-rw-r--r--internal/gitaly/service/operations/merge_test.go29
2 files changed, 8 insertions, 23 deletions
diff --git a/internal/gitaly/service/operations/merge.go b/internal/gitaly/service/operations/merge.go
index fe7b6e198..1bcf9f452 100644
--- a/internal/gitaly/service/operations/merge.go
+++ b/internal/gitaly/service/operations/merge.go
@@ -63,7 +63,7 @@ func (s *Server) merge(
ours string,
theirs string,
) (string, error) {
- treeOID, err := quarantineRepo.MergeTree(ctx, ours, theirs)
+ treeOID, err := quarantineRepo.MergeTree(ctx, ours, theirs, localrepo.WithAllowUnrelatedHistories())
if err != nil {
return "", err
}
diff --git a/internal/gitaly/service/operations/merge_test.go b/internal/gitaly/service/operations/merge_test.go
index 6764a3593..2d44f246d 100644
--- a/internal/gitaly/service/operations/merge_test.go
+++ b/internal/gitaly/service/operations/merge_test.go
@@ -913,38 +913,23 @@ func testUserMergeBranchConflict(t *testing.T, ctx context.Context) {
ctx, cfg, repoProto, repoPath, client := setupOperationsService(t, ctx)
- const baseBranch = "base"
const mergeIntoBranch = "mergeIntoBranch"
const mergeFromBranch = "mergeFromBranch"
const conflictingFile = "file"
- baseCommit := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(baseBranch), gittest.WithTreeEntries(gittest.TreeEntry{
+ baseCommit := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(mergeIntoBranch), gittest.WithTreeEntries(gittest.TreeEntry{
Mode: "100644", Path: conflictingFile, Content: "data",
}))
gittest.Exec(t, cfg, "-C", repoPath, "branch", mergeFromBranch, baseCommit.String())
- divergedInto := gittest.WriteCommit(
- t,
- cfg,
- repoPath,
- gittest.WithBranch(mergeIntoBranch),
- gittest.WithParents(baseCommit),
- gittest.WithTreeEntries(gittest.TreeEntry{
- Mode: "100644", Path: conflictingFile, Content: "data-1",
- }),
- )
+ divergedInto := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(mergeIntoBranch), gittest.WithTreeEntries(gittest.TreeEntry{
+ Mode: "100644", Path: conflictingFile, Content: "data-1",
+ }))
- divergedFrom := gittest.WriteCommit(
- t,
- cfg,
- repoPath,
- gittest.WithBranch(mergeFromBranch),
- gittest.WithParents(baseCommit),
- gittest.WithTreeEntries(gittest.TreeEntry{
- Mode: "100644", Path: conflictingFile, Content: "data-2",
- }),
- )
+ divergedFrom := gittest.WriteCommit(t, cfg, repoPath, gittest.WithBranch(mergeFromBranch), gittest.WithTreeEntries(gittest.TreeEntry{
+ Mode: "100644", Path: conflictingFile, Content: "data-2",
+ }))
mergeBidi, err := client.UserMergeBranch(ctx)
require.NoError(t, err)