diff options
author | Karthik Nayak <knayak@gitlab.com> | 2023-07-24 18:31:21 +0300 |
---|---|---|
committer | Karthik Nayak <knayak@gitlab.com> | 2023-07-24 18:31:21 +0300 |
commit | 9298665449c5abed328ba947dd190e0b7f1b55f6 (patch) | |
tree | 4df1bf32f4e88741b6d95c45eebd6606468d5084 /internal/git2go | |
parent | d1d4879600a3b2013edc03e649f5ef59712b3080 (diff) |
git2go: Remove code around `ResolveConflicts` RPC
Since `ResolveConflicts` RPC is now using a pure git implementation, we
can remove the unused git2go code.
Diffstat (limited to 'internal/git2go')
-rw-r--r-- | internal/git2go/resolve_conflicts.go | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/internal/git2go/resolve_conflicts.go b/internal/git2go/resolve_conflicts.go deleted file mode 100644 index 57089ed79..000000000 --- a/internal/git2go/resolve_conflicts.go +++ /dev/null @@ -1,57 +0,0 @@ -package git2go - -import ( - "bytes" - "context" - "encoding/gob" - "fmt" - - "gitlab.com/gitlab-org/gitaly/v16/internal/git/conflict" - "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" -) - -// ResolveCommand contains arguments to perform a merge commit and resolve any -// conflicts produced from that merge commit -type ResolveCommand struct { - MergeCommand - Resolutions []conflict.Resolution -} - -// ResolveResult returns information about the successful merge and resolution -type ResolveResult struct { - MergeResult - - // Err is set if an error occurred. Err must exist on all gob serialized - // results so that any error can be returned. - Err error -} - -// Resolve will attempt merging and resolving conflicts for the provided request -func (b *Executor) Resolve(ctx context.Context, repo storage.Repository, r ResolveCommand) (ResolveResult, error) { - r.SigningKey = b.signingKey - - if err := r.verify(); err != nil { - return ResolveResult{}, fmt.Errorf("resolve: %w: %s", ErrInvalidArgument, err.Error()) - } - - input := &bytes.Buffer{} - if err := gob.NewEncoder(input).Encode(r); err != nil { - return ResolveResult{}, fmt.Errorf("resolve: %w", err) - } - - stdout, err := b.run(ctx, repo, input, "resolve") - if err != nil { - return ResolveResult{}, err - } - - var response ResolveResult - if err := gob.NewDecoder(stdout).Decode(&response); err != nil { - return ResolveResult{}, fmt.Errorf("resolve: %w", err) - } - - if response.Err != nil { - return ResolveResult{}, response.Err - } - - return response, nil -} |