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:
authorjramsay <jcai@gitlab.com>2019-10-21 19:23:42 +0300
committerJohn Cai <jcai@gitlab.com>2019-10-30 18:43:12 +0300
commitaedd1b3dedf27722c6b23df404e00f005de17b01 (patch)
tree18ea406a7ec3bb5351efcb48c24ad46172b3a5e9
parent50c9942e60aa02dbc708be09588b56b59cc7c0d3 (diff)
DSL for ListNewBlobs, ListNewCommits
-rw-r--r--internal/service/ref/list_new_blobs.go9
-rw-r--r--internal/service/ref/list_new_commits.go6
2 files changed, 10 insertions, 5 deletions
diff --git a/internal/service/ref/list_new_blobs.go b/internal/service/ref/list_new_blobs.go
index e80c9e2f8..fdd03949e 100644
--- a/internal/service/ref/list_new_blobs.go
+++ b/internal/service/ref/list_new_blobs.go
@@ -26,13 +26,14 @@ func (s *server) ListNewBlobs(in *gitalypb.ListNewBlobsRequest, stream gitalypb.
func listNewBlobs(in *gitalypb.ListNewBlobsRequest, stream gitalypb.RefService_ListNewBlobsServer, oid string) error {
ctx := stream.Context()
- cmdArgs := []string{"rev-list", oid, "--objects", "--not", "--all"}
+ cmdFlags := []git.Option{git.Flag{Name: "--objects"}, git.Flag{Name: "--not"}, git.Flag{Name: "--all"}}
- if in.Limit > 0 {
- cmdArgs = append(cmdArgs, "--max-count", fmt.Sprint(in.Limit))
+ if in.GetLimit() > 0 {
+ cmdFlags = append(cmdFlags, git.ValueFlag{Name: "--max-count", Value: fmt.Sprint(in.GetLimit())})
}
- revList, err := git.Command(ctx, in.GetRepository(), cmdArgs...)
+ // the added ^ is to negate the oid since there is a --not option that comes earlier in the arg list
+ revList, err := git.SafeCmd(ctx, in.GetRepository(), nil, git.SubCmd{Name: "rev-list", Flags: cmdFlags, Args: []string{"^" + oid}})
if err != nil {
return err
}
diff --git a/internal/service/ref/list_new_commits.go b/internal/service/ref/list_new_commits.go
index 44a5ba161..d465dca05 100644
--- a/internal/service/ref/list_new_commits.go
+++ b/internal/service/ref/list_new_commits.go
@@ -26,7 +26,11 @@ func (s *server) ListNewCommits(in *gitalypb.ListNewCommitsRequest, stream gital
func listNewCommits(in *gitalypb.ListNewCommitsRequest, stream gitalypb.RefService_ListNewCommitsServer, oid string) error {
ctx := stream.Context()
- revList, err := git.Command(ctx, in.GetRepository(), "rev-list", oid, "--not", "--all")
+ revList, err := git.SafeCmd(ctx, in.GetRepository(), nil, 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
}