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:
Diffstat (limited to 'internal/gitaly/service/ref/list_new_commits.go')
-rw-r--r--internal/gitaly/service/ref/list_new_commits.go73
1 files changed, 0 insertions, 73 deletions
diff --git a/internal/gitaly/service/ref/list_new_commits.go b/internal/gitaly/service/ref/list_new_commits.go
deleted file mode 100644
index dd6f33a78..000000000
--- a/internal/gitaly/service/ref/list_new_commits.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package ref
-
-import (
- "bufio"
-
- "gitlab.com/gitlab-org/gitaly/v14/internal/git"
- "gitlab.com/gitlab-org/gitaly/v14/internal/git/catfile"
- "gitlab.com/gitlab-org/gitaly/v14/internal/helper"
- "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
-)
-
-func (s *server) ListNewCommits(in *gitalypb.ListNewCommitsRequest, stream gitalypb.RefService_ListNewCommitsServer) error {
- oid := in.GetCommitId()
- if err := git.ValidateObjectID(oid); err != nil {
- return helper.ErrInvalidArgument(err)
- }
-
- if err := s.listNewCommits(in, stream, oid); err != nil {
- return helper.ErrInternal(err)
- }
-
- return nil
-}
-
-func (s *server) listNewCommits(in *gitalypb.ListNewCommitsRequest, stream gitalypb.RefService_ListNewCommitsServer, oid string) error {
- ctx := stream.Context()
-
- repo := s.localrepo(in.GetRepository())
-
- revList, err := repo.Exec(ctx, git.SubCmd{
- Name: "rev-list",
- Flags: []git.Option{git.Flag{Name: "--not"}, git.Flag{Name: "--all"}},
- Args: []string{"^" + oid}, // the added ^ is to negate the oid since there is a --not option that comes earlier in the arg list
- })
- if err != nil {
- return err
- }
-
- objectReader, err := s.catfileCache.ObjectReader(ctx, repo)
- if err != nil {
- return err
- }
-
- commits := []*gitalypb.GitCommit{}
- scanner := bufio.NewScanner(revList)
- for scanner.Scan() {
- line := scanner.Text()
-
- commit, err := catfile.GetCommit(ctx, objectReader, git.Revision(line))
- if err != nil {
- return err
- }
- commits = append(commits, commit)
-
- if len(commits) >= 10 {
- response := &gitalypb.ListNewCommitsResponse{Commits: commits}
- if err := stream.Send(response); err != nil {
- return err
- }
-
- commits = commits[:0]
- }
- }
-
- if len(commits) > 0 {
- response := &gitalypb.ListNewCommitsResponse{Commits: commits}
- if err := stream.Send(response); err != nil {
- return err
- }
- }
-
- return revList.Wait()
-}