diff options
author | Vasilii Iakliushin <viakliushin@gitlab.com> | 2023-08-18 19:56:52 +0300 |
---|---|---|
committer | Vasilii Iakliushin <viakliushin@gitlab.com> | 2023-08-18 19:56:52 +0300 |
commit | 1044aeb744266b7edf8080d9986288fd86dfa51d (patch) | |
tree | 87bc64cb5ddc3cb03556e05d40f4622e698c5e6a | |
parent | 46892cb4fa5b0e86b7e86fbb7acda5effac412d6 (diff) |
Add an option to select commits from refs/tags and refs/heads only422152_extend_find_commits_request
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/422152
Changelog: added
-rw-r--r-- | internal/gitaly/service/commit/find_commits.go | 6 | ||||
-rw-r--r-- | proto/commit.proto | 4 | ||||
-rw-r--r-- | proto/go/gitalypb/commit.pb.go | 25 |
3 files changed, 33 insertions, 2 deletions
diff --git a/internal/gitaly/service/commit/find_commits.go b/internal/gitaly/service/commit/find_commits.go index ffe3c010b..1c3288439 100644 --- a/internal/gitaly/service/commit/find_commits.go +++ b/internal/gitaly/service/commit/find_commits.go @@ -273,6 +273,12 @@ func getLogCommandSubCmd(req *gitalypb.FindCommitsRequest) git.Command { if req.GetAll() { subCmd.Flags = append(subCmd.Flags, git.Flag{Name: "--all"}, git.Flag{Name: "--reverse"}) } + if req.GetBranches() { + subCmd.Flags = append(subCmd.Flags, git.Flag{Name: "--branches"}, git.Flag{Name: "--reverse"}) + } + if req.GetTags() { + subCmd.Flags = append(subCmd.Flags, git.Flag{Name: "--tags"}, git.Flag{Name: "--reverse"}) + } if req.GetRevision() != nil { subCmd.Args = []string{string(req.GetRevision())} } diff --git a/proto/commit.proto b/proto/commit.proto index a65523749..48501edd1 100644 --- a/proto/commit.proto +++ b/proto/commit.proto @@ -634,6 +634,10 @@ message FindCommitsRequest { // respectively with `refs/heads`. By sending both, the response will include all // references that match either pattern. repeated bytes include_referenced_by = 18; // protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED + // Return commits from branches (refs/heads/*) can be combined with `tags` + bool branches = 19; + // Return commits from tags (refs/tags/*) can be combined with `branches` + bool tags = 20; } // A single 'page' of the result set diff --git a/proto/go/gitalypb/commit.pb.go b/proto/go/gitalypb/commit.pb.go index be6c3a72b..f3c7181cd 100644 --- a/proto/go/gitalypb/commit.pb.go +++ b/proto/go/gitalypb/commit.pb.go @@ -2402,6 +2402,10 @@ type FindCommitsRequest struct { // respectively with `refs/heads`. By sending both, the response will include all // references that match either pattern. IncludeReferencedBy [][]byte `protobuf:"bytes,18,rep,name=include_referenced_by,json=includeReferencedBy,proto3" json:"include_referenced_by,omitempty"` // protolint:disable:this REPEATED_FIELD_NAMES_PLURALIZED + // Return commits from branches (refs/heads/*) can be combined with `tags` + Branches bool `protobuf:"varint,19,opt,name=branches,proto3" json:"branches,omitempty"` + // Return commits from tags (refs/tags/*) can be combined with `branches` + Tags bool `protobuf:"varint,20,opt,name=tags,proto3" json:"tags,omitempty"` } func (x *FindCommitsRequest) Reset() { @@ -2562,6 +2566,20 @@ func (x *FindCommitsRequest) GetIncludeReferencedBy() [][]byte { return nil } +func (x *FindCommitsRequest) GetBranches() bool { + if x != nil { + return x.Branches + } + return false +} + +func (x *FindCommitsRequest) GetTags() bool { + if x != nil { + return x.Tags + } + return false +} + // A single 'page' of the result set type FindCommitsResponse struct { state protoimpl.MessageState @@ -4415,7 +4433,7 @@ var file_commit_proto_rawDesc = []byte{ 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x47, 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x22, 0xcd, 0x05, 0x0a, 0x12, 0x46, + 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x22, 0xfd, 0x05, 0x0a, 0x12, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, @@ -4458,7 +4476,10 @@ var file_commit_proto_rawDesc = []byte{ 0x53, 0x68, 0x6f, 0x72, 0x74, 0x73, 0x74, 0x61, 0x74, 0x12, 0x32, 0x0a, 0x15, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x5f, 0x62, 0x79, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x13, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, - 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x42, 0x79, 0x22, 0x1b, 0x0a, + 0x65, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x42, 0x79, 0x12, 0x1a, 0x0a, + 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x62, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x1b, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x4f, 0x50, 0x4f, 0x10, 0x01, 0x22, 0x42, 0x0a, 0x13, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, |