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:
authorKarthik Nayak <knayak@gitlab.com>2023-04-25 14:17:09 +0300
committerKarthik Nayak <knayak@gitlab.com>2023-04-26 15:35:07 +0300
commitcef60a0e8b62e24529931fecc144b7fbbcab8a9d (patch)
treee2e6bf244db1173532c95606d4826439c2e1b052
parentd7447883f1f2ccc8551972aba9f5dd28b00fc54e (diff)
conflicts: Extract out the Git2Go implementation
The Git2Go implementation of finding conflict files is currently in-lined into `ListConflictFiles`. This makes it hard to add a feature flag to switch to the upcoming git-merge-tree(1) implementation of the same. To make things easier we extract out this code into a new function `conflictFilesWithGit2Go`. We will introduce a similar function for the git-merge-tree(1) implementation in the upcoming commits. Then we can use a feature flag to switch between the two implementations and eventually remove the Git2Go implementation and inline the newer git-merge-tree(1) implementation.
-rw-r--r--internal/gitaly/service/conflicts/list_conflict_files.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/gitaly/service/conflicts/list_conflict_files.go b/internal/gitaly/service/conflicts/list_conflict_files.go
index f7cf317ac..9d0007757 100644
--- a/internal/gitaly/service/conflicts/list_conflict_files.go
+++ b/internal/gitaly/service/conflicts/list_conflict_files.go
@@ -2,12 +2,14 @@ package conflicts
import (
"bytes"
+ "context"
"errors"
"fmt"
"io"
"unicode/utf8"
"gitlab.com/gitlab-org/gitaly/v15/internal/git"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo"
"gitlab.com/gitlab-org/gitaly/v15/internal/git2go"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service"
"gitlab.com/gitlab-org/gitaly/v15/internal/structerr"
@@ -39,6 +41,17 @@ func (s *server) ListConflictFiles(request *gitalypb.ListConflictFilesRequest, s
return err
}
+ return s.conflictFilesWithGit2Go(ctx, request, stream, ours, theirs, repo, repoPath)
+}
+
+func (s *server) conflictFilesWithGit2Go(
+ ctx context.Context,
+ request *gitalypb.ListConflictFilesRequest,
+ stream gitalypb.ConflictsService_ListConflictFilesServer,
+ ours, theirs git.ObjectID,
+ repo *localrepo.Repo,
+ repoPath string,
+) error {
conflicts, err := s.git2goExecutor.Conflicts(ctx, repo, git2go.ConflictsCommand{
Repository: repoPath,
Ours: ours.String(),