detached a137f54

feat(api): add repository, git, token, event and server services

commit
a137f54f984aa8c562bf2bb9f3ca6bac0cc2c994
author
brice · · 2026-10-10 06:07 UTC
parent
037b5e9
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
20 files · +6623 -5
M README.md +17 -3
@@ -2,7 +2,7 @@
22
33 The public API contract of [ermite](https://git.bnema.dev/bnema/ermite), a single-user Git forge: protobuf definitions for its ConnectRPC services and the Go code generated from them.
44
5-Status: early development, no services defined yet.
5+Status: early development. The contract defines five services (below); the server that implements them is being built.
66
77 ```go
88 import "bnema.dev/ermite-api/gen/ermite"
@@ -10,10 +10,24 @@ import "bnema.dev/ermite-api/gen/ermite"
1010
1111 The contract has no version number. It only changes in backward-compatible ways (new fields, messages, RPCs and services), and CI rejects any breaking change.
1212
13+## Services
14+
15+Handlers are mounted under `/-/api/` by the server. Errors are Connect codes.
16+
17+| Service | RPCs |
18+|---|---|
19+| `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask), `DeleteRepo` |
20+| `GitService` | `ListRefs`, `GetTree`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` |
21+| `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` |
22+| `EventService` | `Watch` (streamed, resumable) |
23+| `ServerService` | `GetVersion` (server version and feature list) |
24+
25+Tokens carry scopes only; presets such as `cli` or `agent` are a client concern.
26+
1327 ## Layout
1428
15-- `proto/ermite/`: `.proto` files of the `ermite` package, checked by `buf lint` and `buf breaking`.
16-- `gen/`: generated Go code, committed. Never edit it by hand.
29+- `proto/ermite/`: `.proto` files of the `ermite` package, one per service (`repo`, `git`, `token`, `event`, `server`) plus shared `types`. Checked by `buf lint` and `buf breaking`.
30+- `gen/ermite/`: generated Go messages. `gen/ermite/ermiteconnect/`: generated Connect clients and handlers. Committed, never edited by hand.
1731
1832 ## Generate
1933
@@ -2,7 +2,7 @@
2 2
3 The public API contract of [ermite](https://git.bnema.dev/bnema/ermite), a single-user Git forge: protobuf definitions for its ConnectRPC services and the Go code generated from them.3 The public API contract of [ermite](https://git.bnema.dev/bnema/ermite), a single-user Git forge: protobuf definitions for its ConnectRPC services and the Go code generated from them.
4 4
5-Status: early development, no services defined yet.5+Status: early development. The contract defines five services (below); the server that implements them is being built.
6 6
7 ```go7 ```go
8 import "bnema.dev/ermite-api/gen/ermite"8 import "bnema.dev/ermite-api/gen/ermite"
@@ -10,10 +10,24 @@ import "bnema.dev/ermite-api/gen/ermite"
10 10
11 The contract has no version number. It only changes in backward-compatible ways (new fields, messages, RPCs and services), and CI rejects any breaking change.11 The contract has no version number. It only changes in backward-compatible ways (new fields, messages, RPCs and services), and CI rejects any breaking change.
12 12
13+## Services
14+
15+Handlers are mounted under `/-/api/` by the server. Errors are Connect codes.
16+
17+| Service | RPCs |
18+|---|---|
19+| `RepoService` | `ListRepos`, `GetRepo`, `CreateRepo`, `UpdateRepo` (field mask), `DeleteRepo` |
20+| `GitService` | `ListRefs`, `GetTree`, `GetBlob` (streamed), `ListCommits`, `GetCommit` (structured diff), `ResolveRevision` |
21+| `TokenService` | `CreateToken` (secret shown once), `ListTokens`, `RevokeToken` |
22+| `EventService` | `Watch` (streamed, resumable) |
23+| `ServerService` | `GetVersion` (server version and feature list) |
24+
25+Tokens carry scopes only; presets such as `cli` or `agent` are a client concern.
26+
13 ## Layout27 ## Layout
14 28
15-- `proto/ermite/`: `.proto` files of the `ermite` package, checked by `buf lint` and `buf breaking`.29+- `proto/ermite/`: `.proto` files of the `ermite` package, one per service (`repo`, `git`, `token`, `event`, `server`) plus shared `types`. Checked by `buf lint` and `buf breaking`.
16-- `gen/`: generated Go code, committed. Never edit it by hand.30+- `gen/ermite/`: generated Go messages. `gen/ermite/ermiteconnect/`: generated Connect clients and handlers. Committed, never edited by hand.
17 31
18 ## Generate32 ## Generate
19 33
A gen/ermite/ermiteconnect/event.connect.go +128 -0
@@ -0,0 +1,128 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/event.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // EventServiceName is the fully-qualified name of the EventService service.
27+ EventServiceName = "ermite.EventService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // EventServiceWatchProcedure is the fully-qualified name of the EventService's Watch RPC.
39+ EventServiceWatchProcedure = "/ermite.EventService/Watch"
40+)
41+
42+// EventServiceClient is a client for the ermite.EventService service.
43+type EventServiceClient interface {
44+ // Watch streams events until the client cancels the call or the server shuts
45+ // down. Events are filtered by the caller's access: events of a private
46+ // repository are only sent to callers that may read it.
47+ //
48+ // The server keeps a bounded buffer of recent events. With resume_after set,
49+ // buffered events after that id are replayed first, then live events follow.
50+ // When resume_after is no longer buffered (or unknown), the stream begins
51+ // with a Gap event, then continues with the oldest buffered event: the client
52+ // must reload its state. Without resume_after, only new events are sent.
53+ Watch(context.Context, *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error)
54+}
55+
56+// NewEventServiceClient constructs a client for the ermite.EventService service. By default, it
57+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
58+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
59+// connect.WithGRPCWeb() options.
60+//
61+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
62+// http://api.acme.com or https://acme.com/grpc).
63+func NewEventServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EventServiceClient {
64+ baseURL = strings.TrimRight(baseURL, "/")
65+ eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
66+ return &eventServiceClient{
67+ watch: connect.NewClient[ermite.WatchRequest, ermite.WatchResponse](
68+ httpClient,
69+ baseURL+EventServiceWatchProcedure,
70+ connect.WithSchema(eventServiceMethods.ByName("Watch")),
71+ connect.WithClientOptions(opts...),
72+ ),
73+ }
74+}
75+
76+// eventServiceClient implements EventServiceClient.
77+type eventServiceClient struct {
78+ watch *connect.Client[ermite.WatchRequest, ermite.WatchResponse]
79+}
80+
81+// Watch calls ermite.EventService.Watch.
82+func (c *eventServiceClient) Watch(ctx context.Context, req *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error) {
83+ return c.watch.CallServerStream(ctx, req)
84+}
85+
86+// EventServiceHandler is an implementation of the ermite.EventService service.
87+type EventServiceHandler interface {
88+ // Watch streams events until the client cancels the call or the server shuts
89+ // down. Events are filtered by the caller's access: events of a private
90+ // repository are only sent to callers that may read it.
91+ //
92+ // The server keeps a bounded buffer of recent events. With resume_after set,
93+ // buffered events after that id are replayed first, then live events follow.
94+ // When resume_after is no longer buffered (or unknown), the stream begins
95+ // with a Gap event, then continues with the oldest buffered event: the client
96+ // must reload its state. Without resume_after, only new events are sent.
97+ Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error
98+}
99+
100+// NewEventServiceHandler builds an HTTP handler from the service implementation. It returns the
101+// path on which to mount the handler and the handler itself.
102+//
103+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
104+// and JSON codecs. They also support gzip compression.
105+func NewEventServiceHandler(svc EventServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
106+ eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
107+ eventServiceWatchHandler := connect.NewServerStreamHandler(
108+ EventServiceWatchProcedure,
109+ svc.Watch,
110+ connect.WithSchema(eventServiceMethods.ByName("Watch")),
111+ connect.WithHandlerOptions(opts...),
112+ )
113+ return "/ermite.EventService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
114+ switch r.URL.Path {
115+ case EventServiceWatchProcedure:
116+ eventServiceWatchHandler.ServeHTTP(w, r)
117+ default:
118+ http.NotFound(w, r)
119+ }
120+ })
121+}
122+
123+// UnimplementedEventServiceHandler returns CodeUnimplemented from all methods.
124+type UnimplementedEventServiceHandler struct{}
125+
126+func (UnimplementedEventServiceHandler) Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error {
127+ return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EventService.Watch is not implemented"))
128+}
@@ -0,0 +1,128 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/event.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // EventServiceName is the fully-qualified name of the EventService service.
27+ EventServiceName = "ermite.EventService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // EventServiceWatchProcedure is the fully-qualified name of the EventService's Watch RPC.
39+ EventServiceWatchProcedure = "/ermite.EventService/Watch"
40+)
41+
42+// EventServiceClient is a client for the ermite.EventService service.
43+type EventServiceClient interface {
44+ // Watch streams events until the client cancels the call or the server shuts
45+ // down. Events are filtered by the caller's access: events of a private
46+ // repository are only sent to callers that may read it.
47+ //
48+ // The server keeps a bounded buffer of recent events. With resume_after set,
49+ // buffered events after that id are replayed first, then live events follow.
50+ // When resume_after is no longer buffered (or unknown), the stream begins
51+ // with a Gap event, then continues with the oldest buffered event: the client
52+ // must reload its state. Without resume_after, only new events are sent.
53+ Watch(context.Context, *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error)
54+}
55+
56+// NewEventServiceClient constructs a client for the ermite.EventService service. By default, it
57+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
58+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
59+// connect.WithGRPCWeb() options.
60+//
61+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
62+// http://api.acme.com or https://acme.com/grpc).
63+func NewEventServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) EventServiceClient {
64+ baseURL = strings.TrimRight(baseURL, "/")
65+ eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
66+ return &eventServiceClient{
67+ watch: connect.NewClient[ermite.WatchRequest, ermite.WatchResponse](
68+ httpClient,
69+ baseURL+EventServiceWatchProcedure,
70+ connect.WithSchema(eventServiceMethods.ByName("Watch")),
71+ connect.WithClientOptions(opts...),
72+ ),
73+ }
74+}
75+
76+// eventServiceClient implements EventServiceClient.
77+type eventServiceClient struct {
78+ watch *connect.Client[ermite.WatchRequest, ermite.WatchResponse]
79+}
80+
81+// Watch calls ermite.EventService.Watch.
82+func (c *eventServiceClient) Watch(ctx context.Context, req *connect.Request[ermite.WatchRequest]) (*connect.ServerStreamForClient[ermite.WatchResponse], error) {
83+ return c.watch.CallServerStream(ctx, req)
84+}
85+
86+// EventServiceHandler is an implementation of the ermite.EventService service.
87+type EventServiceHandler interface {
88+ // Watch streams events until the client cancels the call or the server shuts
89+ // down. Events are filtered by the caller's access: events of a private
90+ // repository are only sent to callers that may read it.
91+ //
92+ // The server keeps a bounded buffer of recent events. With resume_after set,
93+ // buffered events after that id are replayed first, then live events follow.
94+ // When resume_after is no longer buffered (or unknown), the stream begins
95+ // with a Gap event, then continues with the oldest buffered event: the client
96+ // must reload its state. Without resume_after, only new events are sent.
97+ Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error
98+}
99+
100+// NewEventServiceHandler builds an HTTP handler from the service implementation. It returns the
101+// path on which to mount the handler and the handler itself.
102+//
103+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
104+// and JSON codecs. They also support gzip compression.
105+func NewEventServiceHandler(svc EventServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
106+ eventServiceMethods := ermite.File_ermite_event_proto.Services().ByName("EventService").Methods()
107+ eventServiceWatchHandler := connect.NewServerStreamHandler(
108+ EventServiceWatchProcedure,
109+ svc.Watch,
110+ connect.WithSchema(eventServiceMethods.ByName("Watch")),
111+ connect.WithHandlerOptions(opts...),
112+ )
113+ return "/ermite.EventService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
114+ switch r.URL.Path {
115+ case EventServiceWatchProcedure:
116+ eventServiceWatchHandler.ServeHTTP(w, r)
117+ default:
118+ http.NotFound(w, r)
119+ }
120+ })
121+}
122+
123+// UnimplementedEventServiceHandler returns CodeUnimplemented from all methods.
124+type UnimplementedEventServiceHandler struct{}
125+
126+func (UnimplementedEventServiceHandler) Watch(context.Context, *connect.Request[ermite.WatchRequest], *connect.ServerStream[ermite.WatchResponse]) error {
127+ return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.EventService.Watch is not implemented"))
128+}
A gen/ermite/ermiteconnect/git.connect.go +281 -0
@@ -0,0 +1,281 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/git.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // GitServiceName is the fully-qualified name of the GitService service.
27+ GitServiceName = "ermite.GitService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // GitServiceListRefsProcedure is the fully-qualified name of the GitService's ListRefs RPC.
39+ GitServiceListRefsProcedure = "/ermite.GitService/ListRefs"
40+ // GitServiceGetTreeProcedure is the fully-qualified name of the GitService's GetTree RPC.
41+ GitServiceGetTreeProcedure = "/ermite.GitService/GetTree"
42+ // GitServiceGetBlobProcedure is the fully-qualified name of the GitService's GetBlob RPC.
43+ GitServiceGetBlobProcedure = "/ermite.GitService/GetBlob"
44+ // GitServiceListCommitsProcedure is the fully-qualified name of the GitService's ListCommits RPC.
45+ GitServiceListCommitsProcedure = "/ermite.GitService/ListCommits"
46+ // GitServiceGetCommitProcedure is the fully-qualified name of the GitService's GetCommit RPC.
47+ GitServiceGetCommitProcedure = "/ermite.GitService/GetCommit"
48+ // GitServiceResolveRevisionProcedure is the fully-qualified name of the GitService's
49+ // ResolveRevision RPC.
50+ GitServiceResolveRevisionProcedure = "/ermite.GitService/ResolveRevision"
51+)
52+
53+// GitServiceClient is a client for the ermite.GitService service.
54+type GitServiceClient interface {
55+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
56+ // ordered by kind (HEAD, branches, tags) then by name.
57+ ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error)
58+ // GetTree lists the entries of a directory at a revision. Fails with
59+ // not_found if the path does not exist and invalid_argument if it is not a
60+ // directory.
61+ GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error)
62+ // GetBlob streams the content of a file at a revision, in chunks of at most
63+ // 64 KiB. The first message carries the metadata in info, then the chunks
64+ // follow; the memory used by the server does not depend on the file size.
65+ // Fails with not_found if the path does not exist and invalid_argument if it
66+ // is not a file.
67+ GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error)
68+ // ListCommits lists the history reachable from a revision, newest first
69+ // (Git's default order), optionally limited to the commits that touched a
70+ // path.
71+ ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error)
72+ // GetCommit returns one commit with its statistics and its diff.
73+ GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error)
74+ // ResolveRevision turns a revision into the id of the commit it designates.
75+ ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error)
76+}
77+
78+// NewGitServiceClient constructs a client for the ermite.GitService service. By default, it uses
79+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
80+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
81+// connect.WithGRPCWeb() options.
82+//
83+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
84+// http://api.acme.com or https://acme.com/grpc).
85+func NewGitServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GitServiceClient {
86+ baseURL = strings.TrimRight(baseURL, "/")
87+ gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods()
88+ return &gitServiceClient{
89+ listRefs: connect.NewClient[ermite.ListRefsRequest, ermite.ListRefsResponse](
90+ httpClient,
91+ baseURL+GitServiceListRefsProcedure,
92+ connect.WithSchema(gitServiceMethods.ByName("ListRefs")),
93+ connect.WithClientOptions(opts...),
94+ ),
95+ getTree: connect.NewClient[ermite.GetTreeRequest, ermite.GetTreeResponse](
96+ httpClient,
97+ baseURL+GitServiceGetTreeProcedure,
98+ connect.WithSchema(gitServiceMethods.ByName("GetTree")),
99+ connect.WithClientOptions(opts...),
100+ ),
101+ getBlob: connect.NewClient[ermite.GetBlobRequest, ermite.GetBlobResponse](
102+ httpClient,
103+ baseURL+GitServiceGetBlobProcedure,
104+ connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
105+ connect.WithClientOptions(opts...),
106+ ),
107+ listCommits: connect.NewClient[ermite.ListCommitsRequest, ermite.ListCommitsResponse](
108+ httpClient,
109+ baseURL+GitServiceListCommitsProcedure,
110+ connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
111+ connect.WithClientOptions(opts...),
112+ ),
113+ getCommit: connect.NewClient[ermite.GetCommitRequest, ermite.GetCommitResponse](
114+ httpClient,
115+ baseURL+GitServiceGetCommitProcedure,
116+ connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
117+ connect.WithClientOptions(opts...),
118+ ),
119+ resolveRevision: connect.NewClient[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse](
120+ httpClient,
121+ baseURL+GitServiceResolveRevisionProcedure,
122+ connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")),
123+ connect.WithClientOptions(opts...),
124+ ),
125+ }
126+}
127+
128+// gitServiceClient implements GitServiceClient.
129+type gitServiceClient struct {
130+ listRefs *connect.Client[ermite.ListRefsRequest, ermite.ListRefsResponse]
131+ getTree *connect.Client[ermite.GetTreeRequest, ermite.GetTreeResponse]
132+ getBlob *connect.Client[ermite.GetBlobRequest, ermite.GetBlobResponse]
133+ listCommits *connect.Client[ermite.ListCommitsRequest, ermite.ListCommitsResponse]
134+ getCommit *connect.Client[ermite.GetCommitRequest, ermite.GetCommitResponse]
135+ resolveRevision *connect.Client[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse]
136+}
137+
138+// ListRefs calls ermite.GitService.ListRefs.
139+func (c *gitServiceClient) ListRefs(ctx context.Context, req *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) {
140+ return c.listRefs.CallUnary(ctx, req)
141+}
142+
143+// GetTree calls ermite.GitService.GetTree.
144+func (c *gitServiceClient) GetTree(ctx context.Context, req *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) {
145+ return c.getTree.CallUnary(ctx, req)
146+}
147+
148+// GetBlob calls ermite.GitService.GetBlob.
149+func (c *gitServiceClient) GetBlob(ctx context.Context, req *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error) {
150+ return c.getBlob.CallServerStream(ctx, req)
151+}
152+
153+// ListCommits calls ermite.GitService.ListCommits.
154+func (c *gitServiceClient) ListCommits(ctx context.Context, req *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) {
155+ return c.listCommits.CallUnary(ctx, req)
156+}
157+
158+// GetCommit calls ermite.GitService.GetCommit.
159+func (c *gitServiceClient) GetCommit(ctx context.Context, req *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) {
160+ return c.getCommit.CallUnary(ctx, req)
161+}
162+
163+// ResolveRevision calls ermite.GitService.ResolveRevision.
164+func (c *gitServiceClient) ResolveRevision(ctx context.Context, req *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) {
165+ return c.resolveRevision.CallUnary(ctx, req)
166+}
167+
168+// GitServiceHandler is an implementation of the ermite.GitService service.
169+type GitServiceHandler interface {
170+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
171+ // ordered by kind (HEAD, branches, tags) then by name.
172+ ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error)
173+ // GetTree lists the entries of a directory at a revision. Fails with
174+ // not_found if the path does not exist and invalid_argument if it is not a
175+ // directory.
176+ GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error)
177+ // GetBlob streams the content of a file at a revision, in chunks of at most
178+ // 64 KiB. The first message carries the metadata in info, then the chunks
179+ // follow; the memory used by the server does not depend on the file size.
180+ // Fails with not_found if the path does not exist and invalid_argument if it
181+ // is not a file.
182+ GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error
183+ // ListCommits lists the history reachable from a revision, newest first
184+ // (Git's default order), optionally limited to the commits that touched a
185+ // path.
186+ ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error)
187+ // GetCommit returns one commit with its statistics and its diff.
188+ GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error)
189+ // ResolveRevision turns a revision into the id of the commit it designates.
190+ ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error)
191+}
192+
193+// NewGitServiceHandler builds an HTTP handler from the service implementation. It returns the path
194+// on which to mount the handler and the handler itself.
195+//
196+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
197+// and JSON codecs. They also support gzip compression.
198+func NewGitServiceHandler(svc GitServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
199+ gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods()
200+ gitServiceListRefsHandler := connect.NewUnaryHandler(
201+ GitServiceListRefsProcedure,
202+ svc.ListRefs,
203+ connect.WithSchema(gitServiceMethods.ByName("ListRefs")),
204+ connect.WithHandlerOptions(opts...),
205+ )
206+ gitServiceGetTreeHandler := connect.NewUnaryHandler(
207+ GitServiceGetTreeProcedure,
208+ svc.GetTree,
209+ connect.WithSchema(gitServiceMethods.ByName("GetTree")),
210+ connect.WithHandlerOptions(opts...),
211+ )
212+ gitServiceGetBlobHandler := connect.NewServerStreamHandler(
213+ GitServiceGetBlobProcedure,
214+ svc.GetBlob,
215+ connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
216+ connect.WithHandlerOptions(opts...),
217+ )
218+ gitServiceListCommitsHandler := connect.NewUnaryHandler(
219+ GitServiceListCommitsProcedure,
220+ svc.ListCommits,
221+ connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
222+ connect.WithHandlerOptions(opts...),
223+ )
224+ gitServiceGetCommitHandler := connect.NewUnaryHandler(
225+ GitServiceGetCommitProcedure,
226+ svc.GetCommit,
227+ connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
228+ connect.WithHandlerOptions(opts...),
229+ )
230+ gitServiceResolveRevisionHandler := connect.NewUnaryHandler(
231+ GitServiceResolveRevisionProcedure,
232+ svc.ResolveRevision,
233+ connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")),
234+ connect.WithHandlerOptions(opts...),
235+ )
236+ return "/ermite.GitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
237+ switch r.URL.Path {
238+ case GitServiceListRefsProcedure:
239+ gitServiceListRefsHandler.ServeHTTP(w, r)
240+ case GitServiceGetTreeProcedure:
241+ gitServiceGetTreeHandler.ServeHTTP(w, r)
242+ case GitServiceGetBlobProcedure:
243+ gitServiceGetBlobHandler.ServeHTTP(w, r)
244+ case GitServiceListCommitsProcedure:
245+ gitServiceListCommitsHandler.ServeHTTP(w, r)
246+ case GitServiceGetCommitProcedure:
247+ gitServiceGetCommitHandler.ServeHTTP(w, r)
248+ case GitServiceResolveRevisionProcedure:
249+ gitServiceResolveRevisionHandler.ServeHTTP(w, r)
250+ default:
251+ http.NotFound(w, r)
252+ }
253+ })
254+}
255+
256+// UnimplementedGitServiceHandler returns CodeUnimplemented from all methods.
257+type UnimplementedGitServiceHandler struct{}
258+
259+func (UnimplementedGitServiceHandler) ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) {
260+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListRefs is not implemented"))
261+}
262+
263+func (UnimplementedGitServiceHandler) GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) {
264+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetTree is not implemented"))
265+}
266+
267+func (UnimplementedGitServiceHandler) GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error {
268+ return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetBlob is not implemented"))
269+}
270+
271+func (UnimplementedGitServiceHandler) ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) {
272+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListCommits is not implemented"))
273+}
274+
275+func (UnimplementedGitServiceHandler) GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) {
276+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetCommit is not implemented"))
277+}
278+
279+func (UnimplementedGitServiceHandler) ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) {
280+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ResolveRevision is not implemented"))
281+}
@@ -0,0 +1,281 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/git.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // GitServiceName is the fully-qualified name of the GitService service.
27+ GitServiceName = "ermite.GitService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // GitServiceListRefsProcedure is the fully-qualified name of the GitService's ListRefs RPC.
39+ GitServiceListRefsProcedure = "/ermite.GitService/ListRefs"
40+ // GitServiceGetTreeProcedure is the fully-qualified name of the GitService's GetTree RPC.
41+ GitServiceGetTreeProcedure = "/ermite.GitService/GetTree"
42+ // GitServiceGetBlobProcedure is the fully-qualified name of the GitService's GetBlob RPC.
43+ GitServiceGetBlobProcedure = "/ermite.GitService/GetBlob"
44+ // GitServiceListCommitsProcedure is the fully-qualified name of the GitService's ListCommits RPC.
45+ GitServiceListCommitsProcedure = "/ermite.GitService/ListCommits"
46+ // GitServiceGetCommitProcedure is the fully-qualified name of the GitService's GetCommit RPC.
47+ GitServiceGetCommitProcedure = "/ermite.GitService/GetCommit"
48+ // GitServiceResolveRevisionProcedure is the fully-qualified name of the GitService's
49+ // ResolveRevision RPC.
50+ GitServiceResolveRevisionProcedure = "/ermite.GitService/ResolveRevision"
51+)
52+
53+// GitServiceClient is a client for the ermite.GitService service.
54+type GitServiceClient interface {
55+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
56+ // ordered by kind (HEAD, branches, tags) then by name.
57+ ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error)
58+ // GetTree lists the entries of a directory at a revision. Fails with
59+ // not_found if the path does not exist and invalid_argument if it is not a
60+ // directory.
61+ GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error)
62+ // GetBlob streams the content of a file at a revision, in chunks of at most
63+ // 64 KiB. The first message carries the metadata in info, then the chunks
64+ // follow; the memory used by the server does not depend on the file size.
65+ // Fails with not_found if the path does not exist and invalid_argument if it
66+ // is not a file.
67+ GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error)
68+ // ListCommits lists the history reachable from a revision, newest first
69+ // (Git's default order), optionally limited to the commits that touched a
70+ // path.
71+ ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error)
72+ // GetCommit returns one commit with its statistics and its diff.
73+ GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error)
74+ // ResolveRevision turns a revision into the id of the commit it designates.
75+ ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error)
76+}
77+
78+// NewGitServiceClient constructs a client for the ermite.GitService service. By default, it uses
79+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
80+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
81+// connect.WithGRPCWeb() options.
82+//
83+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
84+// http://api.acme.com or https://acme.com/grpc).
85+func NewGitServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) GitServiceClient {
86+ baseURL = strings.TrimRight(baseURL, "/")
87+ gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods()
88+ return &gitServiceClient{
89+ listRefs: connect.NewClient[ermite.ListRefsRequest, ermite.ListRefsResponse](
90+ httpClient,
91+ baseURL+GitServiceListRefsProcedure,
92+ connect.WithSchema(gitServiceMethods.ByName("ListRefs")),
93+ connect.WithClientOptions(opts...),
94+ ),
95+ getTree: connect.NewClient[ermite.GetTreeRequest, ermite.GetTreeResponse](
96+ httpClient,
97+ baseURL+GitServiceGetTreeProcedure,
98+ connect.WithSchema(gitServiceMethods.ByName("GetTree")),
99+ connect.WithClientOptions(opts...),
100+ ),
101+ getBlob: connect.NewClient[ermite.GetBlobRequest, ermite.GetBlobResponse](
102+ httpClient,
103+ baseURL+GitServiceGetBlobProcedure,
104+ connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
105+ connect.WithClientOptions(opts...),
106+ ),
107+ listCommits: connect.NewClient[ermite.ListCommitsRequest, ermite.ListCommitsResponse](
108+ httpClient,
109+ baseURL+GitServiceListCommitsProcedure,
110+ connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
111+ connect.WithClientOptions(opts...),
112+ ),
113+ getCommit: connect.NewClient[ermite.GetCommitRequest, ermite.GetCommitResponse](
114+ httpClient,
115+ baseURL+GitServiceGetCommitProcedure,
116+ connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
117+ connect.WithClientOptions(opts...),
118+ ),
119+ resolveRevision: connect.NewClient[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse](
120+ httpClient,
121+ baseURL+GitServiceResolveRevisionProcedure,
122+ connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")),
123+ connect.WithClientOptions(opts...),
124+ ),
125+ }
126+}
127+
128+// gitServiceClient implements GitServiceClient.
129+type gitServiceClient struct {
130+ listRefs *connect.Client[ermite.ListRefsRequest, ermite.ListRefsResponse]
131+ getTree *connect.Client[ermite.GetTreeRequest, ermite.GetTreeResponse]
132+ getBlob *connect.Client[ermite.GetBlobRequest, ermite.GetBlobResponse]
133+ listCommits *connect.Client[ermite.ListCommitsRequest, ermite.ListCommitsResponse]
134+ getCommit *connect.Client[ermite.GetCommitRequest, ermite.GetCommitResponse]
135+ resolveRevision *connect.Client[ermite.ResolveRevisionRequest, ermite.ResolveRevisionResponse]
136+}
137+
138+// ListRefs calls ermite.GitService.ListRefs.
139+func (c *gitServiceClient) ListRefs(ctx context.Context, req *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) {
140+ return c.listRefs.CallUnary(ctx, req)
141+}
142+
143+// GetTree calls ermite.GitService.GetTree.
144+func (c *gitServiceClient) GetTree(ctx context.Context, req *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) {
145+ return c.getTree.CallUnary(ctx, req)
146+}
147+
148+// GetBlob calls ermite.GitService.GetBlob.
149+func (c *gitServiceClient) GetBlob(ctx context.Context, req *connect.Request[ermite.GetBlobRequest]) (*connect.ServerStreamForClient[ermite.GetBlobResponse], error) {
150+ return c.getBlob.CallServerStream(ctx, req)
151+}
152+
153+// ListCommits calls ermite.GitService.ListCommits.
154+func (c *gitServiceClient) ListCommits(ctx context.Context, req *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) {
155+ return c.listCommits.CallUnary(ctx, req)
156+}
157+
158+// GetCommit calls ermite.GitService.GetCommit.
159+func (c *gitServiceClient) GetCommit(ctx context.Context, req *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) {
160+ return c.getCommit.CallUnary(ctx, req)
161+}
162+
163+// ResolveRevision calls ermite.GitService.ResolveRevision.
164+func (c *gitServiceClient) ResolveRevision(ctx context.Context, req *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) {
165+ return c.resolveRevision.CallUnary(ctx, req)
166+}
167+
168+// GitServiceHandler is an implementation of the ermite.GitService service.
169+type GitServiceHandler interface {
170+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
171+ // ordered by kind (HEAD, branches, tags) then by name.
172+ ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error)
173+ // GetTree lists the entries of a directory at a revision. Fails with
174+ // not_found if the path does not exist and invalid_argument if it is not a
175+ // directory.
176+ GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error)
177+ // GetBlob streams the content of a file at a revision, in chunks of at most
178+ // 64 KiB. The first message carries the metadata in info, then the chunks
179+ // follow; the memory used by the server does not depend on the file size.
180+ // Fails with not_found if the path does not exist and invalid_argument if it
181+ // is not a file.
182+ GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error
183+ // ListCommits lists the history reachable from a revision, newest first
184+ // (Git's default order), optionally limited to the commits that touched a
185+ // path.
186+ ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error)
187+ // GetCommit returns one commit with its statistics and its diff.
188+ GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error)
189+ // ResolveRevision turns a revision into the id of the commit it designates.
190+ ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error)
191+}
192+
193+// NewGitServiceHandler builds an HTTP handler from the service implementation. It returns the path
194+// on which to mount the handler and the handler itself.
195+//
196+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
197+// and JSON codecs. They also support gzip compression.
198+func NewGitServiceHandler(svc GitServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
199+ gitServiceMethods := ermite.File_ermite_git_proto.Services().ByName("GitService").Methods()
200+ gitServiceListRefsHandler := connect.NewUnaryHandler(
201+ GitServiceListRefsProcedure,
202+ svc.ListRefs,
203+ connect.WithSchema(gitServiceMethods.ByName("ListRefs")),
204+ connect.WithHandlerOptions(opts...),
205+ )
206+ gitServiceGetTreeHandler := connect.NewUnaryHandler(
207+ GitServiceGetTreeProcedure,
208+ svc.GetTree,
209+ connect.WithSchema(gitServiceMethods.ByName("GetTree")),
210+ connect.WithHandlerOptions(opts...),
211+ )
212+ gitServiceGetBlobHandler := connect.NewServerStreamHandler(
213+ GitServiceGetBlobProcedure,
214+ svc.GetBlob,
215+ connect.WithSchema(gitServiceMethods.ByName("GetBlob")),
216+ connect.WithHandlerOptions(opts...),
217+ )
218+ gitServiceListCommitsHandler := connect.NewUnaryHandler(
219+ GitServiceListCommitsProcedure,
220+ svc.ListCommits,
221+ connect.WithSchema(gitServiceMethods.ByName("ListCommits")),
222+ connect.WithHandlerOptions(opts...),
223+ )
224+ gitServiceGetCommitHandler := connect.NewUnaryHandler(
225+ GitServiceGetCommitProcedure,
226+ svc.GetCommit,
227+ connect.WithSchema(gitServiceMethods.ByName("GetCommit")),
228+ connect.WithHandlerOptions(opts...),
229+ )
230+ gitServiceResolveRevisionHandler := connect.NewUnaryHandler(
231+ GitServiceResolveRevisionProcedure,
232+ svc.ResolveRevision,
233+ connect.WithSchema(gitServiceMethods.ByName("ResolveRevision")),
234+ connect.WithHandlerOptions(opts...),
235+ )
236+ return "/ermite.GitService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
237+ switch r.URL.Path {
238+ case GitServiceListRefsProcedure:
239+ gitServiceListRefsHandler.ServeHTTP(w, r)
240+ case GitServiceGetTreeProcedure:
241+ gitServiceGetTreeHandler.ServeHTTP(w, r)
242+ case GitServiceGetBlobProcedure:
243+ gitServiceGetBlobHandler.ServeHTTP(w, r)
244+ case GitServiceListCommitsProcedure:
245+ gitServiceListCommitsHandler.ServeHTTP(w, r)
246+ case GitServiceGetCommitProcedure:
247+ gitServiceGetCommitHandler.ServeHTTP(w, r)
248+ case GitServiceResolveRevisionProcedure:
249+ gitServiceResolveRevisionHandler.ServeHTTP(w, r)
250+ default:
251+ http.NotFound(w, r)
252+ }
253+ })
254+}
255+
256+// UnimplementedGitServiceHandler returns CodeUnimplemented from all methods.
257+type UnimplementedGitServiceHandler struct{}
258+
259+func (UnimplementedGitServiceHandler) ListRefs(context.Context, *connect.Request[ermite.ListRefsRequest]) (*connect.Response[ermite.ListRefsResponse], error) {
260+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListRefs is not implemented"))
261+}
262+
263+func (UnimplementedGitServiceHandler) GetTree(context.Context, *connect.Request[ermite.GetTreeRequest]) (*connect.Response[ermite.GetTreeResponse], error) {
264+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetTree is not implemented"))
265+}
266+
267+func (UnimplementedGitServiceHandler) GetBlob(context.Context, *connect.Request[ermite.GetBlobRequest], *connect.ServerStream[ermite.GetBlobResponse]) error {
268+ return connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetBlob is not implemented"))
269+}
270+
271+func (UnimplementedGitServiceHandler) ListCommits(context.Context, *connect.Request[ermite.ListCommitsRequest]) (*connect.Response[ermite.ListCommitsResponse], error) {
272+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ListCommits is not implemented"))
273+}
274+
275+func (UnimplementedGitServiceHandler) GetCommit(context.Context, *connect.Request[ermite.GetCommitRequest]) (*connect.Response[ermite.GetCommitResponse], error) {
276+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.GetCommit is not implemented"))
277+}
278+
279+func (UnimplementedGitServiceHandler) ResolveRevision(context.Context, *connect.Request[ermite.ResolveRevisionRequest]) (*connect.Response[ermite.ResolveRevisionResponse], error) {
280+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.GitService.ResolveRevision is not implemented"))
281+}
A gen/ermite/ermiteconnect/repo.connect.go +242 -0
@@ -0,0 +1,242 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/repo.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // RepoServiceName is the fully-qualified name of the RepoService service.
27+ RepoServiceName = "ermite.RepoService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // RepoServiceListReposProcedure is the fully-qualified name of the RepoService's ListRepos RPC.
39+ RepoServiceListReposProcedure = "/ermite.RepoService/ListRepos"
40+ // RepoServiceGetRepoProcedure is the fully-qualified name of the RepoService's GetRepo RPC.
41+ RepoServiceGetRepoProcedure = "/ermite.RepoService/GetRepo"
42+ // RepoServiceCreateRepoProcedure is the fully-qualified name of the RepoService's CreateRepo RPC.
43+ RepoServiceCreateRepoProcedure = "/ermite.RepoService/CreateRepo"
44+ // RepoServiceUpdateRepoProcedure is the fully-qualified name of the RepoService's UpdateRepo RPC.
45+ RepoServiceUpdateRepoProcedure = "/ermite.RepoService/UpdateRepo"
46+ // RepoServiceDeleteRepoProcedure is the fully-qualified name of the RepoService's DeleteRepo RPC.
47+ RepoServiceDeleteRepoProcedure = "/ermite.RepoService/DeleteRepo"
48+)
49+
50+// RepoServiceClient is a client for the ermite.RepoService service.
51+type RepoServiceClient interface {
52+ // ListRepos lists the repositories the caller may see, ordered by name.
53+ ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error)
54+ // GetRepo returns one repository. Fails with not_found if it does not exist
55+ // or is private and not readable by the caller.
56+ GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error)
57+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
58+ // with already_exists if the name is taken and invalid_argument if the name
59+ // is not valid.
60+ CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error)
61+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
62+ // scope.
63+ UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error)
64+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
65+ // moves the data aside rather than destroying it; there is no undelete RPC.
66+ DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error)
67+}
68+
69+// NewRepoServiceClient constructs a client for the ermite.RepoService service. By default, it uses
70+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
71+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
72+// connect.WithGRPCWeb() options.
73+//
74+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
75+// http://api.acme.com or https://acme.com/grpc).
76+func NewRepoServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RepoServiceClient {
77+ baseURL = strings.TrimRight(baseURL, "/")
78+ repoServiceMethods := ermite.File_ermite_repo_proto.Services().ByName("RepoService").Methods()
79+ return &repoServiceClient{
80+ listRepos: connect.NewClient[ermite.ListReposRequest, ermite.ListReposResponse](
81+ httpClient,
82+ baseURL+RepoServiceListReposProcedure,
83+ connect.WithSchema(repoServiceMethods.ByName("ListRepos")),
84+ connect.WithClientOptions(opts...),
85+ ),
86+ getRepo: connect.NewClient[ermite.GetRepoRequest, ermite.GetRepoResponse](
87+ httpClient,
88+ baseURL+RepoServiceGetRepoProcedure,
89+ connect.WithSchema(repoServiceMethods.ByName("GetRepo")),
90+ connect.WithClientOptions(opts...),
91+ ),
92+ createRepo: connect.NewClient[ermite.CreateRepoRequest, ermite.CreateRepoResponse](
93+ httpClient,
94+ baseURL+RepoServiceCreateRepoProcedure,
95+ connect.WithSchema(repoServiceMethods.ByName("CreateRepo")),
96+ connect.WithClientOptions(opts...),
97+ ),
98+ updateRepo: connect.NewClient[ermite.UpdateRepoRequest, ermite.UpdateRepoResponse](
99+ httpClient,
100+ baseURL+RepoServiceUpdateRepoProcedure,
101+ connect.WithSchema(repoServiceMethods.ByName("UpdateRepo")),
102+ connect.WithClientOptions(opts...),
103+ ),
104+ deleteRepo: connect.NewClient[ermite.DeleteRepoRequest, ermite.DeleteRepoResponse](
105+ httpClient,
106+ baseURL+RepoServiceDeleteRepoProcedure,
107+ connect.WithSchema(repoServiceMethods.ByName("DeleteRepo")),
108+ connect.WithClientOptions(opts...),
109+ ),
110+ }
111+}
112+
113+// repoServiceClient implements RepoServiceClient.
114+type repoServiceClient struct {
115+ listRepos *connect.Client[ermite.ListReposRequest, ermite.ListReposResponse]
116+ getRepo *connect.Client[ermite.GetRepoRequest, ermite.GetRepoResponse]
117+ createRepo *connect.Client[ermite.CreateRepoRequest, ermite.CreateRepoResponse]
118+ updateRepo *connect.Client[ermite.UpdateRepoRequest, ermite.UpdateRepoResponse]
119+ deleteRepo *connect.Client[ermite.DeleteRepoRequest, ermite.DeleteRepoResponse]
120+}
121+
122+// ListRepos calls ermite.RepoService.ListRepos.
123+func (c *repoServiceClient) ListRepos(ctx context.Context, req *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error) {
124+ return c.listRepos.CallUnary(ctx, req)
125+}
126+
127+// GetRepo calls ermite.RepoService.GetRepo.
128+func (c *repoServiceClient) GetRepo(ctx context.Context, req *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error) {
129+ return c.getRepo.CallUnary(ctx, req)
130+}
131+
132+// CreateRepo calls ermite.RepoService.CreateRepo.
133+func (c *repoServiceClient) CreateRepo(ctx context.Context, req *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error) {
134+ return c.createRepo.CallUnary(ctx, req)
135+}
136+
137+// UpdateRepo calls ermite.RepoService.UpdateRepo.
138+func (c *repoServiceClient) UpdateRepo(ctx context.Context, req *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error) {
139+ return c.updateRepo.CallUnary(ctx, req)
140+}
141+
142+// DeleteRepo calls ermite.RepoService.DeleteRepo.
143+func (c *repoServiceClient) DeleteRepo(ctx context.Context, req *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error) {
144+ return c.deleteRepo.CallUnary(ctx, req)
145+}
146+
147+// RepoServiceHandler is an implementation of the ermite.RepoService service.
148+type RepoServiceHandler interface {
149+ // ListRepos lists the repositories the caller may see, ordered by name.
150+ ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error)
151+ // GetRepo returns one repository. Fails with not_found if it does not exist
152+ // or is private and not readable by the caller.
153+ GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error)
154+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
155+ // with already_exists if the name is taken and invalid_argument if the name
156+ // is not valid.
157+ CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error)
158+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
159+ // scope.
160+ UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error)
161+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
162+ // moves the data aside rather than destroying it; there is no undelete RPC.
163+ DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error)
164+}
165+
166+// NewRepoServiceHandler builds an HTTP handler from the service implementation. It returns the path
167+// on which to mount the handler and the handler itself.
168+//
169+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
170+// and JSON codecs. They also support gzip compression.
171+func NewRepoServiceHandler(svc RepoServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
172+ repoServiceMethods := ermite.File_ermite_repo_proto.Services().ByName("RepoService").Methods()
173+ repoServiceListReposHandler := connect.NewUnaryHandler(
174+ RepoServiceListReposProcedure,
175+ svc.ListRepos,
176+ connect.WithSchema(repoServiceMethods.ByName("ListRepos")),
177+ connect.WithHandlerOptions(opts...),
178+ )
179+ repoServiceGetRepoHandler := connect.NewUnaryHandler(
180+ RepoServiceGetRepoProcedure,
181+ svc.GetRepo,
182+ connect.WithSchema(repoServiceMethods.ByName("GetRepo")),
183+ connect.WithHandlerOptions(opts...),
184+ )
185+ repoServiceCreateRepoHandler := connect.NewUnaryHandler(
186+ RepoServiceCreateRepoProcedure,
187+ svc.CreateRepo,
188+ connect.WithSchema(repoServiceMethods.ByName("CreateRepo")),
189+ connect.WithHandlerOptions(opts...),
190+ )
191+ repoServiceUpdateRepoHandler := connect.NewUnaryHandler(
192+ RepoServiceUpdateRepoProcedure,
193+ svc.UpdateRepo,
194+ connect.WithSchema(repoServiceMethods.ByName("UpdateRepo")),
195+ connect.WithHandlerOptions(opts...),
196+ )
197+ repoServiceDeleteRepoHandler := connect.NewUnaryHandler(
198+ RepoServiceDeleteRepoProcedure,
199+ svc.DeleteRepo,
200+ connect.WithSchema(repoServiceMethods.ByName("DeleteRepo")),
201+ connect.WithHandlerOptions(opts...),
202+ )
203+ return "/ermite.RepoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
204+ switch r.URL.Path {
205+ case RepoServiceListReposProcedure:
206+ repoServiceListReposHandler.ServeHTTP(w, r)
207+ case RepoServiceGetRepoProcedure:
208+ repoServiceGetRepoHandler.ServeHTTP(w, r)
209+ case RepoServiceCreateRepoProcedure:
210+ repoServiceCreateRepoHandler.ServeHTTP(w, r)
211+ case RepoServiceUpdateRepoProcedure:
212+ repoServiceUpdateRepoHandler.ServeHTTP(w, r)
213+ case RepoServiceDeleteRepoProcedure:
214+ repoServiceDeleteRepoHandler.ServeHTTP(w, r)
215+ default:
216+ http.NotFound(w, r)
217+ }
218+ })
219+}
220+
221+// UnimplementedRepoServiceHandler returns CodeUnimplemented from all methods.
222+type UnimplementedRepoServiceHandler struct{}
223+
224+func (UnimplementedRepoServiceHandler) ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error) {
225+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.ListRepos is not implemented"))
226+}
227+
228+func (UnimplementedRepoServiceHandler) GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error) {
229+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.GetRepo is not implemented"))
230+}
231+
232+func (UnimplementedRepoServiceHandler) CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error) {
233+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.CreateRepo is not implemented"))
234+}
235+
236+func (UnimplementedRepoServiceHandler) UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error) {
237+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.UpdateRepo is not implemented"))
238+}
239+
240+func (UnimplementedRepoServiceHandler) DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error) {
241+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.DeleteRepo is not implemented"))
242+}
@@ -0,0 +1,242 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/repo.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // RepoServiceName is the fully-qualified name of the RepoService service.
27+ RepoServiceName = "ermite.RepoService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // RepoServiceListReposProcedure is the fully-qualified name of the RepoService's ListRepos RPC.
39+ RepoServiceListReposProcedure = "/ermite.RepoService/ListRepos"
40+ // RepoServiceGetRepoProcedure is the fully-qualified name of the RepoService's GetRepo RPC.
41+ RepoServiceGetRepoProcedure = "/ermite.RepoService/GetRepo"
42+ // RepoServiceCreateRepoProcedure is the fully-qualified name of the RepoService's CreateRepo RPC.
43+ RepoServiceCreateRepoProcedure = "/ermite.RepoService/CreateRepo"
44+ // RepoServiceUpdateRepoProcedure is the fully-qualified name of the RepoService's UpdateRepo RPC.
45+ RepoServiceUpdateRepoProcedure = "/ermite.RepoService/UpdateRepo"
46+ // RepoServiceDeleteRepoProcedure is the fully-qualified name of the RepoService's DeleteRepo RPC.
47+ RepoServiceDeleteRepoProcedure = "/ermite.RepoService/DeleteRepo"
48+)
49+
50+// RepoServiceClient is a client for the ermite.RepoService service.
51+type RepoServiceClient interface {
52+ // ListRepos lists the repositories the caller may see, ordered by name.
53+ ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error)
54+ // GetRepo returns one repository. Fails with not_found if it does not exist
55+ // or is private and not readable by the caller.
56+ GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error)
57+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
58+ // with already_exists if the name is taken and invalid_argument if the name
59+ // is not valid.
60+ CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error)
61+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
62+ // scope.
63+ UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error)
64+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
65+ // moves the data aside rather than destroying it; there is no undelete RPC.
66+ DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error)
67+}
68+
69+// NewRepoServiceClient constructs a client for the ermite.RepoService service. By default, it uses
70+// the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
71+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
72+// connect.WithGRPCWeb() options.
73+//
74+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
75+// http://api.acme.com or https://acme.com/grpc).
76+func NewRepoServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RepoServiceClient {
77+ baseURL = strings.TrimRight(baseURL, "/")
78+ repoServiceMethods := ermite.File_ermite_repo_proto.Services().ByName("RepoService").Methods()
79+ return &repoServiceClient{
80+ listRepos: connect.NewClient[ermite.ListReposRequest, ermite.ListReposResponse](
81+ httpClient,
82+ baseURL+RepoServiceListReposProcedure,
83+ connect.WithSchema(repoServiceMethods.ByName("ListRepos")),
84+ connect.WithClientOptions(opts...),
85+ ),
86+ getRepo: connect.NewClient[ermite.GetRepoRequest, ermite.GetRepoResponse](
87+ httpClient,
88+ baseURL+RepoServiceGetRepoProcedure,
89+ connect.WithSchema(repoServiceMethods.ByName("GetRepo")),
90+ connect.WithClientOptions(opts...),
91+ ),
92+ createRepo: connect.NewClient[ermite.CreateRepoRequest, ermite.CreateRepoResponse](
93+ httpClient,
94+ baseURL+RepoServiceCreateRepoProcedure,
95+ connect.WithSchema(repoServiceMethods.ByName("CreateRepo")),
96+ connect.WithClientOptions(opts...),
97+ ),
98+ updateRepo: connect.NewClient[ermite.UpdateRepoRequest, ermite.UpdateRepoResponse](
99+ httpClient,
100+ baseURL+RepoServiceUpdateRepoProcedure,
101+ connect.WithSchema(repoServiceMethods.ByName("UpdateRepo")),
102+ connect.WithClientOptions(opts...),
103+ ),
104+ deleteRepo: connect.NewClient[ermite.DeleteRepoRequest, ermite.DeleteRepoResponse](
105+ httpClient,
106+ baseURL+RepoServiceDeleteRepoProcedure,
107+ connect.WithSchema(repoServiceMethods.ByName("DeleteRepo")),
108+ connect.WithClientOptions(opts...),
109+ ),
110+ }
111+}
112+
113+// repoServiceClient implements RepoServiceClient.
114+type repoServiceClient struct {
115+ listRepos *connect.Client[ermite.ListReposRequest, ermite.ListReposResponse]
116+ getRepo *connect.Client[ermite.GetRepoRequest, ermite.GetRepoResponse]
117+ createRepo *connect.Client[ermite.CreateRepoRequest, ermite.CreateRepoResponse]
118+ updateRepo *connect.Client[ermite.UpdateRepoRequest, ermite.UpdateRepoResponse]
119+ deleteRepo *connect.Client[ermite.DeleteRepoRequest, ermite.DeleteRepoResponse]
120+}
121+
122+// ListRepos calls ermite.RepoService.ListRepos.
123+func (c *repoServiceClient) ListRepos(ctx context.Context, req *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error) {
124+ return c.listRepos.CallUnary(ctx, req)
125+}
126+
127+// GetRepo calls ermite.RepoService.GetRepo.
128+func (c *repoServiceClient) GetRepo(ctx context.Context, req *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error) {
129+ return c.getRepo.CallUnary(ctx, req)
130+}
131+
132+// CreateRepo calls ermite.RepoService.CreateRepo.
133+func (c *repoServiceClient) CreateRepo(ctx context.Context, req *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error) {
134+ return c.createRepo.CallUnary(ctx, req)
135+}
136+
137+// UpdateRepo calls ermite.RepoService.UpdateRepo.
138+func (c *repoServiceClient) UpdateRepo(ctx context.Context, req *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error) {
139+ return c.updateRepo.CallUnary(ctx, req)
140+}
141+
142+// DeleteRepo calls ermite.RepoService.DeleteRepo.
143+func (c *repoServiceClient) DeleteRepo(ctx context.Context, req *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error) {
144+ return c.deleteRepo.CallUnary(ctx, req)
145+}
146+
147+// RepoServiceHandler is an implementation of the ermite.RepoService service.
148+type RepoServiceHandler interface {
149+ // ListRepos lists the repositories the caller may see, ordered by name.
150+ ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error)
151+ // GetRepo returns one repository. Fails with not_found if it does not exist
152+ // or is private and not readable by the caller.
153+ GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error)
154+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
155+ // with already_exists if the name is taken and invalid_argument if the name
156+ // is not valid.
157+ CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error)
158+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
159+ // scope.
160+ UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error)
161+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
162+ // moves the data aside rather than destroying it; there is no undelete RPC.
163+ DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error)
164+}
165+
166+// NewRepoServiceHandler builds an HTTP handler from the service implementation. It returns the path
167+// on which to mount the handler and the handler itself.
168+//
169+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
170+// and JSON codecs. They also support gzip compression.
171+func NewRepoServiceHandler(svc RepoServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
172+ repoServiceMethods := ermite.File_ermite_repo_proto.Services().ByName("RepoService").Methods()
173+ repoServiceListReposHandler := connect.NewUnaryHandler(
174+ RepoServiceListReposProcedure,
175+ svc.ListRepos,
176+ connect.WithSchema(repoServiceMethods.ByName("ListRepos")),
177+ connect.WithHandlerOptions(opts...),
178+ )
179+ repoServiceGetRepoHandler := connect.NewUnaryHandler(
180+ RepoServiceGetRepoProcedure,
181+ svc.GetRepo,
182+ connect.WithSchema(repoServiceMethods.ByName("GetRepo")),
183+ connect.WithHandlerOptions(opts...),
184+ )
185+ repoServiceCreateRepoHandler := connect.NewUnaryHandler(
186+ RepoServiceCreateRepoProcedure,
187+ svc.CreateRepo,
188+ connect.WithSchema(repoServiceMethods.ByName("CreateRepo")),
189+ connect.WithHandlerOptions(opts...),
190+ )
191+ repoServiceUpdateRepoHandler := connect.NewUnaryHandler(
192+ RepoServiceUpdateRepoProcedure,
193+ svc.UpdateRepo,
194+ connect.WithSchema(repoServiceMethods.ByName("UpdateRepo")),
195+ connect.WithHandlerOptions(opts...),
196+ )
197+ repoServiceDeleteRepoHandler := connect.NewUnaryHandler(
198+ RepoServiceDeleteRepoProcedure,
199+ svc.DeleteRepo,
200+ connect.WithSchema(repoServiceMethods.ByName("DeleteRepo")),
201+ connect.WithHandlerOptions(opts...),
202+ )
203+ return "/ermite.RepoService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
204+ switch r.URL.Path {
205+ case RepoServiceListReposProcedure:
206+ repoServiceListReposHandler.ServeHTTP(w, r)
207+ case RepoServiceGetRepoProcedure:
208+ repoServiceGetRepoHandler.ServeHTTP(w, r)
209+ case RepoServiceCreateRepoProcedure:
210+ repoServiceCreateRepoHandler.ServeHTTP(w, r)
211+ case RepoServiceUpdateRepoProcedure:
212+ repoServiceUpdateRepoHandler.ServeHTTP(w, r)
213+ case RepoServiceDeleteRepoProcedure:
214+ repoServiceDeleteRepoHandler.ServeHTTP(w, r)
215+ default:
216+ http.NotFound(w, r)
217+ }
218+ })
219+}
220+
221+// UnimplementedRepoServiceHandler returns CodeUnimplemented from all methods.
222+type UnimplementedRepoServiceHandler struct{}
223+
224+func (UnimplementedRepoServiceHandler) ListRepos(context.Context, *connect.Request[ermite.ListReposRequest]) (*connect.Response[ermite.ListReposResponse], error) {
225+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.ListRepos is not implemented"))
226+}
227+
228+func (UnimplementedRepoServiceHandler) GetRepo(context.Context, *connect.Request[ermite.GetRepoRequest]) (*connect.Response[ermite.GetRepoResponse], error) {
229+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.GetRepo is not implemented"))
230+}
231+
232+func (UnimplementedRepoServiceHandler) CreateRepo(context.Context, *connect.Request[ermite.CreateRepoRequest]) (*connect.Response[ermite.CreateRepoResponse], error) {
233+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.CreateRepo is not implemented"))
234+}
235+
236+func (UnimplementedRepoServiceHandler) UpdateRepo(context.Context, *connect.Request[ermite.UpdateRepoRequest]) (*connect.Response[ermite.UpdateRepoResponse], error) {
237+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.UpdateRepo is not implemented"))
238+}
239+
240+func (UnimplementedRepoServiceHandler) DeleteRepo(context.Context, *connect.Request[ermite.DeleteRepoRequest]) (*connect.Response[ermite.DeleteRepoResponse], error) {
241+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.RepoService.DeleteRepo is not implemented"))
242+}
A gen/ermite/ermiteconnect/server.connect.go +117 -0
@@ -0,0 +1,117 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/server.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // ServerServiceName is the fully-qualified name of the ServerService service.
27+ ServerServiceName = "ermite.ServerService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // ServerServiceGetVersionProcedure is the fully-qualified name of the ServerService's GetVersion
39+ // RPC.
40+ ServerServiceGetVersionProcedure = "/ermite.ServerService/GetVersion"
41+)
42+
43+// ServerServiceClient is a client for the ermite.ServerService service.
44+type ServerServiceClient interface {
45+ // GetVersion returns the server version and the optional capabilities of the
46+ // contract it implements. It needs no authentication, so a client can call
47+ // it first to check compatibility.
48+ GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
49+}
50+
51+// NewServerServiceClient constructs a client for the ermite.ServerService service. By default, it
52+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
53+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
54+// connect.WithGRPCWeb() options.
55+//
56+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
57+// http://api.acme.com or https://acme.com/grpc).
58+func NewServerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ServerServiceClient {
59+ baseURL = strings.TrimRight(baseURL, "/")
60+ serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
61+ return &serverServiceClient{
62+ getVersion: connect.NewClient[ermite.GetVersionRequest, ermite.GetVersionResponse](
63+ httpClient,
64+ baseURL+ServerServiceGetVersionProcedure,
65+ connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
66+ connect.WithClientOptions(opts...),
67+ ),
68+ }
69+}
70+
71+// serverServiceClient implements ServerServiceClient.
72+type serverServiceClient struct {
73+ getVersion *connect.Client[ermite.GetVersionRequest, ermite.GetVersionResponse]
74+}
75+
76+// GetVersion calls ermite.ServerService.GetVersion.
77+func (c *serverServiceClient) GetVersion(ctx context.Context, req *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
78+ return c.getVersion.CallUnary(ctx, req)
79+}
80+
81+// ServerServiceHandler is an implementation of the ermite.ServerService service.
82+type ServerServiceHandler interface {
83+ // GetVersion returns the server version and the optional capabilities of the
84+ // contract it implements. It needs no authentication, so a client can call
85+ // it first to check compatibility.
86+ GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
87+}
88+
89+// NewServerServiceHandler builds an HTTP handler from the service implementation. It returns the
90+// path on which to mount the handler and the handler itself.
91+//
92+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
93+// and JSON codecs. They also support gzip compression.
94+func NewServerServiceHandler(svc ServerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
95+ serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
96+ serverServiceGetVersionHandler := connect.NewUnaryHandler(
97+ ServerServiceGetVersionProcedure,
98+ svc.GetVersion,
99+ connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
100+ connect.WithHandlerOptions(opts...),
101+ )
102+ return "/ermite.ServerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
103+ switch r.URL.Path {
104+ case ServerServiceGetVersionProcedure:
105+ serverServiceGetVersionHandler.ServeHTTP(w, r)
106+ default:
107+ http.NotFound(w, r)
108+ }
109+ })
110+}
111+
112+// UnimplementedServerServiceHandler returns CodeUnimplemented from all methods.
113+type UnimplementedServerServiceHandler struct{}
114+
115+func (UnimplementedServerServiceHandler) GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
116+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetVersion is not implemented"))
117+}
@@ -0,0 +1,117 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/server.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // ServerServiceName is the fully-qualified name of the ServerService service.
27+ ServerServiceName = "ermite.ServerService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // ServerServiceGetVersionProcedure is the fully-qualified name of the ServerService's GetVersion
39+ // RPC.
40+ ServerServiceGetVersionProcedure = "/ermite.ServerService/GetVersion"
41+)
42+
43+// ServerServiceClient is a client for the ermite.ServerService service.
44+type ServerServiceClient interface {
45+ // GetVersion returns the server version and the optional capabilities of the
46+ // contract it implements. It needs no authentication, so a client can call
47+ // it first to check compatibility.
48+ GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
49+}
50+
51+// NewServerServiceClient constructs a client for the ermite.ServerService service. By default, it
52+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
53+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
54+// connect.WithGRPCWeb() options.
55+//
56+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
57+// http://api.acme.com or https://acme.com/grpc).
58+func NewServerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) ServerServiceClient {
59+ baseURL = strings.TrimRight(baseURL, "/")
60+ serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
61+ return &serverServiceClient{
62+ getVersion: connect.NewClient[ermite.GetVersionRequest, ermite.GetVersionResponse](
63+ httpClient,
64+ baseURL+ServerServiceGetVersionProcedure,
65+ connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
66+ connect.WithClientOptions(opts...),
67+ ),
68+ }
69+}
70+
71+// serverServiceClient implements ServerServiceClient.
72+type serverServiceClient struct {
73+ getVersion *connect.Client[ermite.GetVersionRequest, ermite.GetVersionResponse]
74+}
75+
76+// GetVersion calls ermite.ServerService.GetVersion.
77+func (c *serverServiceClient) GetVersion(ctx context.Context, req *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
78+ return c.getVersion.CallUnary(ctx, req)
79+}
80+
81+// ServerServiceHandler is an implementation of the ermite.ServerService service.
82+type ServerServiceHandler interface {
83+ // GetVersion returns the server version and the optional capabilities of the
84+ // contract it implements. It needs no authentication, so a client can call
85+ // it first to check compatibility.
86+ GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error)
87+}
88+
89+// NewServerServiceHandler builds an HTTP handler from the service implementation. It returns the
90+// path on which to mount the handler and the handler itself.
91+//
92+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
93+// and JSON codecs. They also support gzip compression.
94+func NewServerServiceHandler(svc ServerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
95+ serverServiceMethods := ermite.File_ermite_server_proto.Services().ByName("ServerService").Methods()
96+ serverServiceGetVersionHandler := connect.NewUnaryHandler(
97+ ServerServiceGetVersionProcedure,
98+ svc.GetVersion,
99+ connect.WithSchema(serverServiceMethods.ByName("GetVersion")),
100+ connect.WithHandlerOptions(opts...),
101+ )
102+ return "/ermite.ServerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
103+ switch r.URL.Path {
104+ case ServerServiceGetVersionProcedure:
105+ serverServiceGetVersionHandler.ServeHTTP(w, r)
106+ default:
107+ http.NotFound(w, r)
108+ }
109+ })
110+}
111+
112+// UnimplementedServerServiceHandler returns CodeUnimplemented from all methods.
113+type UnimplementedServerServiceHandler struct{}
114+
115+func (UnimplementedServerServiceHandler) GetVersion(context.Context, *connect.Request[ermite.GetVersionRequest]) (*connect.Response[ermite.GetVersionResponse], error) {
116+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.ServerService.GetVersion is not implemented"))
117+}
A gen/ermite/ermiteconnect/token.connect.go +182 -0
@@ -0,0 +1,182 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/token.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // TokenServiceName is the fully-qualified name of the TokenService service.
27+ TokenServiceName = "ermite.TokenService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // TokenServiceCreateTokenProcedure is the fully-qualified name of the TokenService's CreateToken
39+ // RPC.
40+ TokenServiceCreateTokenProcedure = "/ermite.TokenService/CreateToken"
41+ // TokenServiceListTokensProcedure is the fully-qualified name of the TokenService's ListTokens RPC.
42+ TokenServiceListTokensProcedure = "/ermite.TokenService/ListTokens"
43+ // TokenServiceRevokeTokenProcedure is the fully-qualified name of the TokenService's RevokeToken
44+ // RPC.
45+ TokenServiceRevokeTokenProcedure = "/ermite.TokenService/RevokeToken"
46+)
47+
48+// TokenServiceClient is a client for the ermite.TokenService service.
49+type TokenServiceClient interface {
50+ // CreateToken creates a token and returns its secret. The secret is shown
51+ // only in this response and cannot be retrieved later. Fails with
52+ // permission_denied when the new token would exceed the caller's limits and
53+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
54+ CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error)
55+ // ListTokens lists stored tokens, newest first.
56+ ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error)
57+ // RevokeToken deletes a token; it stops working immediately. Fails with
58+ // not_found if the id is unknown.
59+ RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error)
60+}
61+
62+// NewTokenServiceClient constructs a client for the ermite.TokenService service. By default, it
63+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
64+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
65+// connect.WithGRPCWeb() options.
66+//
67+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
68+// http://api.acme.com or https://acme.com/grpc).
69+func NewTokenServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TokenServiceClient {
70+ baseURL = strings.TrimRight(baseURL, "/")
71+ tokenServiceMethods := ermite.File_ermite_token_proto.Services().ByName("TokenService").Methods()
72+ return &tokenServiceClient{
73+ createToken: connect.NewClient[ermite.CreateTokenRequest, ermite.CreateTokenResponse](
74+ httpClient,
75+ baseURL+TokenServiceCreateTokenProcedure,
76+ connect.WithSchema(tokenServiceMethods.ByName("CreateToken")),
77+ connect.WithClientOptions(opts...),
78+ ),
79+ listTokens: connect.NewClient[ermite.ListTokensRequest, ermite.ListTokensResponse](
80+ httpClient,
81+ baseURL+TokenServiceListTokensProcedure,
82+ connect.WithSchema(tokenServiceMethods.ByName("ListTokens")),
83+ connect.WithClientOptions(opts...),
84+ ),
85+ revokeToken: connect.NewClient[ermite.RevokeTokenRequest, ermite.RevokeTokenResponse](
86+ httpClient,
87+ baseURL+TokenServiceRevokeTokenProcedure,
88+ connect.WithSchema(tokenServiceMethods.ByName("RevokeToken")),
89+ connect.WithClientOptions(opts...),
90+ ),
91+ }
92+}
93+
94+// tokenServiceClient implements TokenServiceClient.
95+type tokenServiceClient struct {
96+ createToken *connect.Client[ermite.CreateTokenRequest, ermite.CreateTokenResponse]
97+ listTokens *connect.Client[ermite.ListTokensRequest, ermite.ListTokensResponse]
98+ revokeToken *connect.Client[ermite.RevokeTokenRequest, ermite.RevokeTokenResponse]
99+}
100+
101+// CreateToken calls ermite.TokenService.CreateToken.
102+func (c *tokenServiceClient) CreateToken(ctx context.Context, req *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error) {
103+ return c.createToken.CallUnary(ctx, req)
104+}
105+
106+// ListTokens calls ermite.TokenService.ListTokens.
107+func (c *tokenServiceClient) ListTokens(ctx context.Context, req *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error) {
108+ return c.listTokens.CallUnary(ctx, req)
109+}
110+
111+// RevokeToken calls ermite.TokenService.RevokeToken.
112+func (c *tokenServiceClient) RevokeToken(ctx context.Context, req *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error) {
113+ return c.revokeToken.CallUnary(ctx, req)
114+}
115+
116+// TokenServiceHandler is an implementation of the ermite.TokenService service.
117+type TokenServiceHandler interface {
118+ // CreateToken creates a token and returns its secret. The secret is shown
119+ // only in this response and cannot be retrieved later. Fails with
120+ // permission_denied when the new token would exceed the caller's limits and
121+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
122+ CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error)
123+ // ListTokens lists stored tokens, newest first.
124+ ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error)
125+ // RevokeToken deletes a token; it stops working immediately. Fails with
126+ // not_found if the id is unknown.
127+ RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error)
128+}
129+
130+// NewTokenServiceHandler builds an HTTP handler from the service implementation. It returns the
131+// path on which to mount the handler and the handler itself.
132+//
133+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
134+// and JSON codecs. They also support gzip compression.
135+func NewTokenServiceHandler(svc TokenServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
136+ tokenServiceMethods := ermite.File_ermite_token_proto.Services().ByName("TokenService").Methods()
137+ tokenServiceCreateTokenHandler := connect.NewUnaryHandler(
138+ TokenServiceCreateTokenProcedure,
139+ svc.CreateToken,
140+ connect.WithSchema(tokenServiceMethods.ByName("CreateToken")),
141+ connect.WithHandlerOptions(opts...),
142+ )
143+ tokenServiceListTokensHandler := connect.NewUnaryHandler(
144+ TokenServiceListTokensProcedure,
145+ svc.ListTokens,
146+ connect.WithSchema(tokenServiceMethods.ByName("ListTokens")),
147+ connect.WithHandlerOptions(opts...),
148+ )
149+ tokenServiceRevokeTokenHandler := connect.NewUnaryHandler(
150+ TokenServiceRevokeTokenProcedure,
151+ svc.RevokeToken,
152+ connect.WithSchema(tokenServiceMethods.ByName("RevokeToken")),
153+ connect.WithHandlerOptions(opts...),
154+ )
155+ return "/ermite.TokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
156+ switch r.URL.Path {
157+ case TokenServiceCreateTokenProcedure:
158+ tokenServiceCreateTokenHandler.ServeHTTP(w, r)
159+ case TokenServiceListTokensProcedure:
160+ tokenServiceListTokensHandler.ServeHTTP(w, r)
161+ case TokenServiceRevokeTokenProcedure:
162+ tokenServiceRevokeTokenHandler.ServeHTTP(w, r)
163+ default:
164+ http.NotFound(w, r)
165+ }
166+ })
167+}
168+
169+// UnimplementedTokenServiceHandler returns CodeUnimplemented from all methods.
170+type UnimplementedTokenServiceHandler struct{}
171+
172+func (UnimplementedTokenServiceHandler) CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error) {
173+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.CreateToken is not implemented"))
174+}
175+
176+func (UnimplementedTokenServiceHandler) ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error) {
177+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.ListTokens is not implemented"))
178+}
179+
180+func (UnimplementedTokenServiceHandler) RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error) {
181+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.RevokeToken is not implemented"))
182+}
@@ -0,0 +1,182 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-connect-go. DO NOT EDIT.
4+//
5+// Source: ermite/token.proto
6+
7+package ermiteconnect
8+
9+import (
10+ ermite "bnema.dev/ermite-api/gen/ermite"
11+ connect "connectrpc.com/connect"
12+ context "context"
13+ errors "errors"
14+ http "net/http"
15+ strings "strings"
16+)
17+
18+// This is a compile-time assertion to ensure that this generated file and the connect package are
19+// compatible. If you get a compiler error that this constant is not defined, this code was
20+// generated with a version of connect newer than the one compiled into your binary. You can fix the
21+// problem by either regenerating this code with an older version of connect or updating the connect
22+// version compiled into your binary.
23+const _ = connect.IsAtLeastVersion1_13_0
24+
25+const (
26+ // TokenServiceName is the fully-qualified name of the TokenService service.
27+ TokenServiceName = "ermite.TokenService"
28+)
29+
30+// These constants are the fully-qualified names of the RPCs defined in this package. They're
31+// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
32+//
33+// Note that these are different from the fully-qualified method names used by
34+// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
35+// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
36+// period.
37+const (
38+ // TokenServiceCreateTokenProcedure is the fully-qualified name of the TokenService's CreateToken
39+ // RPC.
40+ TokenServiceCreateTokenProcedure = "/ermite.TokenService/CreateToken"
41+ // TokenServiceListTokensProcedure is the fully-qualified name of the TokenService's ListTokens RPC.
42+ TokenServiceListTokensProcedure = "/ermite.TokenService/ListTokens"
43+ // TokenServiceRevokeTokenProcedure is the fully-qualified name of the TokenService's RevokeToken
44+ // RPC.
45+ TokenServiceRevokeTokenProcedure = "/ermite.TokenService/RevokeToken"
46+)
47+
48+// TokenServiceClient is a client for the ermite.TokenService service.
49+type TokenServiceClient interface {
50+ // CreateToken creates a token and returns its secret. The secret is shown
51+ // only in this response and cannot be retrieved later. Fails with
52+ // permission_denied when the new token would exceed the caller's limits and
53+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
54+ CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error)
55+ // ListTokens lists stored tokens, newest first.
56+ ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error)
57+ // RevokeToken deletes a token; it stops working immediately. Fails with
58+ // not_found if the id is unknown.
59+ RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error)
60+}
61+
62+// NewTokenServiceClient constructs a client for the ermite.TokenService service. By default, it
63+// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
64+// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
65+// connect.WithGRPCWeb() options.
66+//
67+// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
68+// http://api.acme.com or https://acme.com/grpc).
69+func NewTokenServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TokenServiceClient {
70+ baseURL = strings.TrimRight(baseURL, "/")
71+ tokenServiceMethods := ermite.File_ermite_token_proto.Services().ByName("TokenService").Methods()
72+ return &tokenServiceClient{
73+ createToken: connect.NewClient[ermite.CreateTokenRequest, ermite.CreateTokenResponse](
74+ httpClient,
75+ baseURL+TokenServiceCreateTokenProcedure,
76+ connect.WithSchema(tokenServiceMethods.ByName("CreateToken")),
77+ connect.WithClientOptions(opts...),
78+ ),
79+ listTokens: connect.NewClient[ermite.ListTokensRequest, ermite.ListTokensResponse](
80+ httpClient,
81+ baseURL+TokenServiceListTokensProcedure,
82+ connect.WithSchema(tokenServiceMethods.ByName("ListTokens")),
83+ connect.WithClientOptions(opts...),
84+ ),
85+ revokeToken: connect.NewClient[ermite.RevokeTokenRequest, ermite.RevokeTokenResponse](
86+ httpClient,
87+ baseURL+TokenServiceRevokeTokenProcedure,
88+ connect.WithSchema(tokenServiceMethods.ByName("RevokeToken")),
89+ connect.WithClientOptions(opts...),
90+ ),
91+ }
92+}
93+
94+// tokenServiceClient implements TokenServiceClient.
95+type tokenServiceClient struct {
96+ createToken *connect.Client[ermite.CreateTokenRequest, ermite.CreateTokenResponse]
97+ listTokens *connect.Client[ermite.ListTokensRequest, ermite.ListTokensResponse]
98+ revokeToken *connect.Client[ermite.RevokeTokenRequest, ermite.RevokeTokenResponse]
99+}
100+
101+// CreateToken calls ermite.TokenService.CreateToken.
102+func (c *tokenServiceClient) CreateToken(ctx context.Context, req *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error) {
103+ return c.createToken.CallUnary(ctx, req)
104+}
105+
106+// ListTokens calls ermite.TokenService.ListTokens.
107+func (c *tokenServiceClient) ListTokens(ctx context.Context, req *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error) {
108+ return c.listTokens.CallUnary(ctx, req)
109+}
110+
111+// RevokeToken calls ermite.TokenService.RevokeToken.
112+func (c *tokenServiceClient) RevokeToken(ctx context.Context, req *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error) {
113+ return c.revokeToken.CallUnary(ctx, req)
114+}
115+
116+// TokenServiceHandler is an implementation of the ermite.TokenService service.
117+type TokenServiceHandler interface {
118+ // CreateToken creates a token and returns its secret. The secret is shown
119+ // only in this response and cannot be retrieved later. Fails with
120+ // permission_denied when the new token would exceed the caller's limits and
121+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
122+ CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error)
123+ // ListTokens lists stored tokens, newest first.
124+ ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error)
125+ // RevokeToken deletes a token; it stops working immediately. Fails with
126+ // not_found if the id is unknown.
127+ RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error)
128+}
129+
130+// NewTokenServiceHandler builds an HTTP handler from the service implementation. It returns the
131+// path on which to mount the handler and the handler itself.
132+//
133+// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
134+// and JSON codecs. They also support gzip compression.
135+func NewTokenServiceHandler(svc TokenServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
136+ tokenServiceMethods := ermite.File_ermite_token_proto.Services().ByName("TokenService").Methods()
137+ tokenServiceCreateTokenHandler := connect.NewUnaryHandler(
138+ TokenServiceCreateTokenProcedure,
139+ svc.CreateToken,
140+ connect.WithSchema(tokenServiceMethods.ByName("CreateToken")),
141+ connect.WithHandlerOptions(opts...),
142+ )
143+ tokenServiceListTokensHandler := connect.NewUnaryHandler(
144+ TokenServiceListTokensProcedure,
145+ svc.ListTokens,
146+ connect.WithSchema(tokenServiceMethods.ByName("ListTokens")),
147+ connect.WithHandlerOptions(opts...),
148+ )
149+ tokenServiceRevokeTokenHandler := connect.NewUnaryHandler(
150+ TokenServiceRevokeTokenProcedure,
151+ svc.RevokeToken,
152+ connect.WithSchema(tokenServiceMethods.ByName("RevokeToken")),
153+ connect.WithHandlerOptions(opts...),
154+ )
155+ return "/ermite.TokenService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
156+ switch r.URL.Path {
157+ case TokenServiceCreateTokenProcedure:
158+ tokenServiceCreateTokenHandler.ServeHTTP(w, r)
159+ case TokenServiceListTokensProcedure:
160+ tokenServiceListTokensHandler.ServeHTTP(w, r)
161+ case TokenServiceRevokeTokenProcedure:
162+ tokenServiceRevokeTokenHandler.ServeHTTP(w, r)
163+ default:
164+ http.NotFound(w, r)
165+ }
166+ })
167+}
168+
169+// UnimplementedTokenServiceHandler returns CodeUnimplemented from all methods.
170+type UnimplementedTokenServiceHandler struct{}
171+
172+func (UnimplementedTokenServiceHandler) CreateToken(context.Context, *connect.Request[ermite.CreateTokenRequest]) (*connect.Response[ermite.CreateTokenResponse], error) {
173+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.CreateToken is not implemented"))
174+}
175+
176+func (UnimplementedTokenServiceHandler) ListTokens(context.Context, *connect.Request[ermite.ListTokensRequest]) (*connect.Response[ermite.ListTokensResponse], error) {
177+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.ListTokens is not implemented"))
178+}
179+
180+func (UnimplementedTokenServiceHandler) RevokeToken(context.Context, *connect.Request[ermite.RevokeTokenRequest]) (*connect.Response[ermite.RevokeTokenResponse], error) {
181+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("ermite.TokenService.RevokeToken is not implemented"))
182+}
A gen/ermite/event.pb.go +703 -0 generated file: collapsed
A gen/ermite/git.pb.go +2046 -0
@@ -0,0 +1,2046 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-go. DO NOT EDIT.
4+// versions:
5+// protoc-gen-go v1.36.12
6+// protoc (unknown)
7+// source: ermite/git.proto
8+
9+package ermite
10+
11+import (
12+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
13+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
14+ reflect "reflect"
15+ sync "sync"
16+ unsafe "unsafe"
17+)
18+
19+const (
20+ // Verify that this generated code is sufficiently up-to-date.
21+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
22+ // Verify that runtime/protoimpl is sufficiently up-to-date.
23+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
24+)
25+
26+// RefKind is the kind of a Git ref.
27+type RefKind int32
28+
29+const (
30+ // Not set. In ListRefsRequest.kinds it is rejected; never returned.
31+ RefKind_REF_KIND_UNSPECIFIED RefKind = 0
32+ // A branch (refs/heads/*).
33+ RefKind_REF_KIND_BRANCH RefKind = 1
34+ // A tag (refs/tags/*), lightweight or annotated.
35+ RefKind_REF_KIND_TAG RefKind = 2
36+ // The symbolic ref HEAD, that is the default branch.
37+ RefKind_REF_KIND_HEAD RefKind = 3
38+)
39+
40+// Enum value maps for RefKind.
41+var (
42+ RefKind_name = map[int32]string{
43+ 0: "REF_KIND_UNSPECIFIED",
44+ 1: "REF_KIND_BRANCH",
45+ 2: "REF_KIND_TAG",
46+ 3: "REF_KIND_HEAD",
47+ }
48+ RefKind_value = map[string]int32{
49+ "REF_KIND_UNSPECIFIED": 0,
50+ "REF_KIND_BRANCH": 1,
51+ "REF_KIND_TAG": 2,
52+ "REF_KIND_HEAD": 3,
53+ }
54+)
55+
56+func (x RefKind) Enum() *RefKind {
57+ p := new(RefKind)
58+ *p = x
59+ return p
60+}
61+
62+func (x RefKind) String() string {
63+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
64+}
65+
66+func (RefKind) Descriptor() protoreflect.EnumDescriptor {
67+ return file_ermite_git_proto_enumTypes[0].Descriptor()
68+}
69+
70+func (RefKind) Type() protoreflect.EnumType {
71+ return &file_ermite_git_proto_enumTypes[0]
72+}
73+
74+func (x RefKind) Number() protoreflect.EnumNumber {
75+ return protoreflect.EnumNumber(x)
76+}
77+
78+// Deprecated: Use RefKind.Descriptor instead.
79+func (RefKind) EnumDescriptor() ([]byte, []int) {
80+ return file_ermite_git_proto_rawDescGZIP(), []int{0}
81+}
82+
83+// EntryKind is the kind of an entry of a Git tree.
84+type EntryKind int32
85+
86+const (
87+ // Not set. Never returned.
88+ EntryKind_ENTRY_KIND_UNSPECIFIED EntryKind = 0
89+ // A regular, non-executable file (mode 100644).
90+ EntryKind_ENTRY_KIND_FILE EntryKind = 1
91+ // An executable file (mode 100755).
92+ EntryKind_ENTRY_KIND_EXECUTABLE EntryKind = 2
93+ // A directory (mode 040000).
94+ EntryKind_ENTRY_KIND_DIRECTORY EntryKind = 3
95+ // A symbolic link (mode 120000). The blob content is the link target.
96+ EntryKind_ENTRY_KIND_SYMLINK EntryKind = 4
97+ // A submodule commit (mode 160000). The id is a commit of another
98+ // repository, which this one does not contain.
99+ EntryKind_ENTRY_KIND_SUBMODULE EntryKind = 5
100+)
101+
102+// Enum value maps for EntryKind.
103+var (
104+ EntryKind_name = map[int32]string{
105+ 0: "ENTRY_KIND_UNSPECIFIED",
106+ 1: "ENTRY_KIND_FILE",
107+ 2: "ENTRY_KIND_EXECUTABLE",
108+ 3: "ENTRY_KIND_DIRECTORY",
109+ 4: "ENTRY_KIND_SYMLINK",
110+ 5: "ENTRY_KIND_SUBMODULE",
111+ }
112+ EntryKind_value = map[string]int32{
113+ "ENTRY_KIND_UNSPECIFIED": 0,
114+ "ENTRY_KIND_FILE": 1,
115+ "ENTRY_KIND_EXECUTABLE": 2,
116+ "ENTRY_KIND_DIRECTORY": 3,
117+ "ENTRY_KIND_SYMLINK": 4,
118+ "ENTRY_KIND_SUBMODULE": 5,
119+ }
120+)
121+
122+func (x EntryKind) Enum() *EntryKind {
123+ p := new(EntryKind)
124+ *p = x
125+ return p
126+}
127+
128+func (x EntryKind) String() string {
129+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
130+}
131+
132+func (EntryKind) Descriptor() protoreflect.EnumDescriptor {
133+ return file_ermite_git_proto_enumTypes[1].Descriptor()
134+}
135+
136+func (EntryKind) Type() protoreflect.EnumType {
137+ return &file_ermite_git_proto_enumTypes[1]
138+}
139+
140+func (x EntryKind) Number() protoreflect.EnumNumber {
141+ return protoreflect.EnumNumber(x)
142+}
143+
144+// Deprecated: Use EntryKind.Descriptor instead.
145+func (EntryKind) EnumDescriptor() ([]byte, []int) {
146+ return file_ermite_git_proto_rawDescGZIP(), []int{1}
147+}
148+
149+// FileStatus tells what a commit did to a file.
150+type FileStatus int32
151+
152+const (
153+ // Not set. Never returned.
154+ FileStatus_FILE_STATUS_UNSPECIFIED FileStatus = 0
155+ // The file was added.
156+ FileStatus_FILE_STATUS_ADDED FileStatus = 1
157+ // The file was deleted.
158+ FileStatus_FILE_STATUS_DELETED FileStatus = 2
159+ // The content or the mode of the file changed.
160+ FileStatus_FILE_STATUS_MODIFIED FileStatus = 3
161+ // The file was moved, possibly with changes. Rename detection is done by Git.
162+ FileStatus_FILE_STATUS_RENAMED FileStatus = 4
163+ // The file was copied from another file, possibly with changes.
164+ FileStatus_FILE_STATUS_COPIED FileStatus = 5
165+ // The type of the entry changed, for example a file became a symbolic link.
166+ FileStatus_FILE_STATUS_TYPE_CHANGED FileStatus = 6
167+)
168+
169+// Enum value maps for FileStatus.
170+var (
171+ FileStatus_name = map[int32]string{
172+ 0: "FILE_STATUS_UNSPECIFIED",
173+ 1: "FILE_STATUS_ADDED",
174+ 2: "FILE_STATUS_DELETED",
175+ 3: "FILE_STATUS_MODIFIED",
176+ 4: "FILE_STATUS_RENAMED",
177+ 5: "FILE_STATUS_COPIED",
178+ 6: "FILE_STATUS_TYPE_CHANGED",
179+ }
180+ FileStatus_value = map[string]int32{
181+ "FILE_STATUS_UNSPECIFIED": 0,
182+ "FILE_STATUS_ADDED": 1,
183+ "FILE_STATUS_DELETED": 2,
184+ "FILE_STATUS_MODIFIED": 3,
185+ "FILE_STATUS_RENAMED": 4,
186+ "FILE_STATUS_COPIED": 5,
187+ "FILE_STATUS_TYPE_CHANGED": 6,
188+ }
189+)
190+
191+func (x FileStatus) Enum() *FileStatus {
192+ p := new(FileStatus)
193+ *p = x
194+ return p
195+}
196+
197+func (x FileStatus) String() string {
198+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
199+}
200+
201+func (FileStatus) Descriptor() protoreflect.EnumDescriptor {
202+ return file_ermite_git_proto_enumTypes[2].Descriptor()
203+}
204+
205+func (FileStatus) Type() protoreflect.EnumType {
206+ return &file_ermite_git_proto_enumTypes[2]
207+}
208+
209+func (x FileStatus) Number() protoreflect.EnumNumber {
210+ return protoreflect.EnumNumber(x)
211+}
212+
213+// Deprecated: Use FileStatus.Descriptor instead.
214+func (FileStatus) EnumDescriptor() ([]byte, []int) {
215+ return file_ermite_git_proto_rawDescGZIP(), []int{2}
216+}
217+
218+// LineKind tells how a line of a hunk relates to the two sides of a diff.
219+type LineKind int32
220+
221+const (
222+ // Not set. Never returned.
223+ LineKind_LINE_KIND_UNSPECIFIED LineKind = 0
224+ // The line is present, unchanged, on both sides.
225+ LineKind_LINE_KIND_CONTEXT LineKind = 1
226+ // The line exists only on the new side.
227+ LineKind_LINE_KIND_ADDITION LineKind = 2
228+ // The line exists only on the old side.
229+ LineKind_LINE_KIND_DELETION LineKind = 3
230+)
231+
232+// Enum value maps for LineKind.
233+var (
234+ LineKind_name = map[int32]string{
235+ 0: "LINE_KIND_UNSPECIFIED",
236+ 1: "LINE_KIND_CONTEXT",
237+ 2: "LINE_KIND_ADDITION",
238+ 3: "LINE_KIND_DELETION",
239+ }
240+ LineKind_value = map[string]int32{
241+ "LINE_KIND_UNSPECIFIED": 0,
242+ "LINE_KIND_CONTEXT": 1,
243+ "LINE_KIND_ADDITION": 2,
244+ "LINE_KIND_DELETION": 3,
245+ }
246+)
247+
248+func (x LineKind) Enum() *LineKind {
249+ p := new(LineKind)
250+ *p = x
251+ return p
252+}
253+
254+func (x LineKind) String() string {
255+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
256+}
257+
258+func (LineKind) Descriptor() protoreflect.EnumDescriptor {
259+ return file_ermite_git_proto_enumTypes[3].Descriptor()
260+}
261+
262+func (LineKind) Type() protoreflect.EnumType {
263+ return &file_ermite_git_proto_enumTypes[3]
264+}
265+
266+func (x LineKind) Number() protoreflect.EnumNumber {
267+ return protoreflect.EnumNumber(x)
268+}
269+
270+// Deprecated: Use LineKind.Descriptor instead.
271+func (LineKind) EnumDescriptor() ([]byte, []int) {
272+ return file_ermite_git_proto_rawDescGZIP(), []int{3}
273+}
274+
275+// Ref is a branch, a tag or HEAD.
276+type Ref struct {
277+ state protoimpl.MessageState `protogen:"open.v1"`
278+ // Name is the full ref name, for example "refs/heads/main" or
279+ // "refs/tags/v1.0.0". For HEAD it is "HEAD".
280+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
281+ // ShortName is the name without its "refs/heads/" or "refs/tags/" prefix. For
282+ // HEAD it is the short name of the default branch, or empty if HEAD points
283+ // to a branch that does not exist yet.
284+ ShortName string `protobuf:"bytes,2,opt,name=short_name,json=shortName,proto3" json:"short_name,omitempty"`
285+ // Kind is the kind of the ref.
286+ Kind RefKind `protobuf:"varint,3,opt,name=kind,proto3,enum=ermite.RefKind" json:"kind,omitempty"`
287+ // Id is the id of the object the ref points to. For an annotated tag it is
288+ // the id of the tag object.
289+ Id string `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"`
290+ // CommitId is the id of the commit the ref designates once annotated tags are
291+ // followed. It equals id for branches and lightweight tags. It is empty for
292+ // a tag that points to something other than a commit.
293+ CommitId string `protobuf:"bytes,5,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
294+ unknownFields protoimpl.UnknownFields
295+ sizeCache protoimpl.SizeCache
296+}
297+
298+func (x *Ref) Reset() {
299+ *x = Ref{}
300+ mi := &file_ermite_git_proto_msgTypes[0]
301+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
302+ ms.StoreMessageInfo(mi)
303+}
304+
305+func (x *Ref) String() string {
306+ return protoimpl.X.MessageStringOf(x)
307+}
308+
309+func (*Ref) ProtoMessage() {}
310+
311+func (x *Ref) ProtoReflect() protoreflect.Message {
312+ mi := &file_ermite_git_proto_msgTypes[0]
313+ if x != nil {
314+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
315+ if ms.LoadMessageInfo() == nil {
316+ ms.StoreMessageInfo(mi)
317+ }
318+ return ms
319+ }
320+ return mi.MessageOf(x)
321+}
322+
323+// Deprecated: Use Ref.ProtoReflect.Descriptor instead.
324+func (*Ref) Descriptor() ([]byte, []int) {
325+ return file_ermite_git_proto_rawDescGZIP(), []int{0}
326+}
327+
328+func (x *Ref) GetName() string {
329+ if x != nil {
330+ return x.Name
331+ }
332+ return ""
333+}
334+
335+func (x *Ref) GetShortName() string {
336+ if x != nil {
337+ return x.ShortName
338+ }
339+ return ""
340+}
341+
342+func (x *Ref) GetKind() RefKind {
343+ if x != nil {
344+ return x.Kind
345+ }
346+ return RefKind_REF_KIND_UNSPECIFIED
347+}
348+
349+func (x *Ref) GetId() string {
350+ if x != nil {
351+ return x.Id
352+ }
353+ return ""
354+}
355+
356+func (x *Ref) GetCommitId() string {
357+ if x != nil {
358+ return x.CommitId
359+ }
360+ return ""
361+}
362+
363+// ListRefsRequest selects the refs to list.
364+type ListRefsRequest struct {
365+ state protoimpl.MessageState `protogen:"open.v1"`
366+ // Repo is the repository name.
367+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
368+ // Kinds restricts the result to these kinds. Empty means all kinds.
369+ Kinds []RefKind `protobuf:"varint,2,rep,packed,name=kinds,proto3,enum=ermite.RefKind" json:"kinds,omitempty"`
370+ // PageSize is the maximum number of refs to return. 0 means the server
371+ // default; values above the server maximum are lowered to it.
372+ PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
373+ // PageToken is the next_page_token of a previous response. Empty for the
374+ // first page.
375+ PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
376+ unknownFields protoimpl.UnknownFields
377+ sizeCache protoimpl.SizeCache
378+}
379+
380+func (x *ListRefsRequest) Reset() {
381+ *x = ListRefsRequest{}
382+ mi := &file_ermite_git_proto_msgTypes[1]
383+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
384+ ms.StoreMessageInfo(mi)
385+}
386+
387+func (x *ListRefsRequest) String() string {
388+ return protoimpl.X.MessageStringOf(x)
389+}
390+
391+func (*ListRefsRequest) ProtoMessage() {}
392+
393+func (x *ListRefsRequest) ProtoReflect() protoreflect.Message {
394+ mi := &file_ermite_git_proto_msgTypes[1]
395+ if x != nil {
396+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
397+ if ms.LoadMessageInfo() == nil {
398+ ms.StoreMessageInfo(mi)
399+ }
400+ return ms
401+ }
402+ return mi.MessageOf(x)
403+}
404+
405+// Deprecated: Use ListRefsRequest.ProtoReflect.Descriptor instead.
406+func (*ListRefsRequest) Descriptor() ([]byte, []int) {
407+ return file_ermite_git_proto_rawDescGZIP(), []int{1}
408+}
409+
410+func (x *ListRefsRequest) GetRepo() string {
411+ if x != nil {
412+ return x.Repo
413+ }
414+ return ""
415+}
416+
417+func (x *ListRefsRequest) GetKinds() []RefKind {
418+ if x != nil {
419+ return x.Kinds
420+ }
421+ return nil
422+}
423+
424+func (x *ListRefsRequest) GetPageSize() int32 {
425+ if x != nil {
426+ return x.PageSize
427+ }
428+ return 0
429+}
430+
431+func (x *ListRefsRequest) GetPageToken() string {
432+ if x != nil {
433+ return x.PageToken
434+ }
435+ return ""
436+}
437+
438+// ListRefsResponse is one page of refs.
439+type ListRefsResponse struct {
440+ state protoimpl.MessageState `protogen:"open.v1"`
441+ // Refs are the refs of this page.
442+ Refs []*Ref `protobuf:"bytes,1,rep,name=refs,proto3" json:"refs,omitempty"`
443+ // NextPageToken is passed as page_token to get the next page. Empty when
444+ // there is no next page.
445+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
446+ unknownFields protoimpl.UnknownFields
447+ sizeCache protoimpl.SizeCache
448+}
449+
450+func (x *ListRefsResponse) Reset() {
451+ *x = ListRefsResponse{}
452+ mi := &file_ermite_git_proto_msgTypes[2]
453+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
454+ ms.StoreMessageInfo(mi)
455+}
456+
457+func (x *ListRefsResponse) String() string {
458+ return protoimpl.X.MessageStringOf(x)
459+}
460+
461+func (*ListRefsResponse) ProtoMessage() {}
462+
463+func (x *ListRefsResponse) ProtoReflect() protoreflect.Message {
464+ mi := &file_ermite_git_proto_msgTypes[2]
465+ if x != nil {
466+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
467+ if ms.LoadMessageInfo() == nil {
468+ ms.StoreMessageInfo(mi)
469+ }
470+ return ms
471+ }
472+ return mi.MessageOf(x)
473+}
474+
475+// Deprecated: Use ListRefsResponse.ProtoReflect.Descriptor instead.
476+func (*ListRefsResponse) Descriptor() ([]byte, []int) {
477+ return file_ermite_git_proto_rawDescGZIP(), []int{2}
478+}
479+
480+func (x *ListRefsResponse) GetRefs() []*Ref {
481+ if x != nil {
482+ return x.Refs
483+ }
484+ return nil
485+}
486+
487+func (x *ListRefsResponse) GetNextPageToken() string {
488+ if x != nil {
489+ return x.NextPageToken
490+ }
491+ return ""
492+}
493+
494+// TreeEntry is one entry of a directory.
495+type TreeEntry struct {
496+ state protoimpl.MessageState `protogen:"open.v1"`
497+ // Name is the name of the entry in its directory, without slash.
498+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
499+ // Path is the path of the entry from the repository root, with "/"
500+ // separators and no leading slash.
501+ Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
502+ // Kind is the kind of the entry.
503+ Kind EntryKind `protobuf:"varint,3,opt,name=kind,proto3,enum=ermite.EntryKind" json:"kind,omitempty"`
504+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
505+ Mode uint32 `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"`
506+ // Id is the object id of the blob, tree or submodule commit.
507+ Id string `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
508+ // Size is the size in bytes of a file or symbolic link. It is 0 for
509+ // directories and submodules.
510+ Size int64 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"`
511+ // LastCommit is the latest commit that changed the entry. Set only when the
512+ // request asked for it with include_last_commit.
513+ LastCommit *Commit `protobuf:"bytes,7,opt,name=last_commit,json=lastCommit,proto3" json:"last_commit,omitempty"`
514+ unknownFields protoimpl.UnknownFields
515+ sizeCache protoimpl.SizeCache
516+}
517+
518+func (x *TreeEntry) Reset() {
519+ *x = TreeEntry{}
520+ mi := &file_ermite_git_proto_msgTypes[3]
521+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
522+ ms.StoreMessageInfo(mi)
523+}
524+
525+func (x *TreeEntry) String() string {
526+ return protoimpl.X.MessageStringOf(x)
527+}
528+
529+func (*TreeEntry) ProtoMessage() {}
530+
531+func (x *TreeEntry) ProtoReflect() protoreflect.Message {
532+ mi := &file_ermite_git_proto_msgTypes[3]
533+ if x != nil {
534+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
535+ if ms.LoadMessageInfo() == nil {
536+ ms.StoreMessageInfo(mi)
537+ }
538+ return ms
539+ }
540+ return mi.MessageOf(x)
541+}
542+
543+// Deprecated: Use TreeEntry.ProtoReflect.Descriptor instead.
544+func (*TreeEntry) Descriptor() ([]byte, []int) {
545+ return file_ermite_git_proto_rawDescGZIP(), []int{3}
546+}
547+
548+func (x *TreeEntry) GetName() string {
549+ if x != nil {
550+ return x.Name
551+ }
552+ return ""
553+}
554+
555+func (x *TreeEntry) GetPath() string {
556+ if x != nil {
557+ return x.Path
558+ }
559+ return ""
560+}
561+
562+func (x *TreeEntry) GetKind() EntryKind {
563+ if x != nil {
564+ return x.Kind
565+ }
566+ return EntryKind_ENTRY_KIND_UNSPECIFIED
567+}
568+
569+func (x *TreeEntry) GetMode() uint32 {
570+ if x != nil {
571+ return x.Mode
572+ }
573+ return 0
574+}
575+
576+func (x *TreeEntry) GetId() string {
577+ if x != nil {
578+ return x.Id
579+ }
580+ return ""
581+}
582+
583+func (x *TreeEntry) GetSize() int64 {
584+ if x != nil {
585+ return x.Size
586+ }
587+ return 0
588+}
589+
590+func (x *TreeEntry) GetLastCommit() *Commit {
591+ if x != nil {
592+ return x.LastCommit
593+ }
594+ return nil
595+}
596+
597+// GetTreeRequest selects a directory.
598+type GetTreeRequest struct {
599+ state protoimpl.MessageState `protogen:"open.v1"`
600+ // Repo is the repository name.
601+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
602+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
603+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
604+ // Path is the directory, from the repository root, with "/" separators.
605+ // Empty means the root.
606+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
607+ // IncludeLastCommit asks for the last commit of every entry in last_commit.
608+ // It costs one history walk, so it is off by default and the server may be
609+ // slow on large directories.
610+ IncludeLastCommit bool `protobuf:"varint,4,opt,name=include_last_commit,json=includeLastCommit,proto3" json:"include_last_commit,omitempty"`
611+ unknownFields protoimpl.UnknownFields
612+ sizeCache protoimpl.SizeCache
613+}
614+
615+func (x *GetTreeRequest) Reset() {
616+ *x = GetTreeRequest{}
617+ mi := &file_ermite_git_proto_msgTypes[4]
618+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
619+ ms.StoreMessageInfo(mi)
620+}
621+
622+func (x *GetTreeRequest) String() string {
623+ return protoimpl.X.MessageStringOf(x)
624+}
625+
626+func (*GetTreeRequest) ProtoMessage() {}
627+
628+func (x *GetTreeRequest) ProtoReflect() protoreflect.Message {
629+ mi := &file_ermite_git_proto_msgTypes[4]
630+ if x != nil {
631+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
632+ if ms.LoadMessageInfo() == nil {
633+ ms.StoreMessageInfo(mi)
634+ }
635+ return ms
636+ }
637+ return mi.MessageOf(x)
638+}
639+
640+// Deprecated: Use GetTreeRequest.ProtoReflect.Descriptor instead.
641+func (*GetTreeRequest) Descriptor() ([]byte, []int) {
642+ return file_ermite_git_proto_rawDescGZIP(), []int{4}
643+}
644+
645+func (x *GetTreeRequest) GetRepo() string {
646+ if x != nil {
647+ return x.Repo
648+ }
649+ return ""
650+}
651+
652+func (x *GetTreeRequest) GetRevision() string {
653+ if x != nil {
654+ return x.Revision
655+ }
656+ return ""
657+}
658+
659+func (x *GetTreeRequest) GetPath() string {
660+ if x != nil {
661+ return x.Path
662+ }
663+ return ""
664+}
665+
666+func (x *GetTreeRequest) GetIncludeLastCommit() bool {
667+ if x != nil {
668+ return x.IncludeLastCommit
669+ }
670+ return false
671+}
672+
673+// GetTreeResponse lists a directory.
674+type GetTreeResponse struct {
675+ state protoimpl.MessageState `protogen:"open.v1"`
676+ // CommitId is the id of the commit the revision resolved to.
677+ CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
678+ // TreeId is the object id of the listed directory.
679+ TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"`
680+ // Entries are the entries of the directory: directories first, then the other
681+ // entries, each group ordered by name.
682+ Entries []*TreeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries,omitempty"`
683+ unknownFields protoimpl.UnknownFields
684+ sizeCache protoimpl.SizeCache
685+}
686+
687+func (x *GetTreeResponse) Reset() {
688+ *x = GetTreeResponse{}
689+ mi := &file_ermite_git_proto_msgTypes[5]
690+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
691+ ms.StoreMessageInfo(mi)
692+}
693+
694+func (x *GetTreeResponse) String() string {
695+ return protoimpl.X.MessageStringOf(x)
696+}
697+
698+func (*GetTreeResponse) ProtoMessage() {}
699+
700+func (x *GetTreeResponse) ProtoReflect() protoreflect.Message {
701+ mi := &file_ermite_git_proto_msgTypes[5]
702+ if x != nil {
703+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
704+ if ms.LoadMessageInfo() == nil {
705+ ms.StoreMessageInfo(mi)
706+ }
707+ return ms
708+ }
709+ return mi.MessageOf(x)
710+}
711+
712+// Deprecated: Use GetTreeResponse.ProtoReflect.Descriptor instead.
713+func (*GetTreeResponse) Descriptor() ([]byte, []int) {
714+ return file_ermite_git_proto_rawDescGZIP(), []int{5}
715+}
716+
717+func (x *GetTreeResponse) GetCommitId() string {
718+ if x != nil {
719+ return x.CommitId
720+ }
721+ return ""
722+}
723+
724+func (x *GetTreeResponse) GetTreeId() string {
725+ if x != nil {
726+ return x.TreeId
727+ }
728+ return ""
729+}
730+
731+func (x *GetTreeResponse) GetEntries() []*TreeEntry {
732+ if x != nil {
733+ return x.Entries
734+ }
735+ return nil
736+}
737+
738+// BlobInfo describes a file.
739+type BlobInfo struct {
740+ state protoimpl.MessageState `protogen:"open.v1"`
741+ // Id is the object id of the blob.
742+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
743+ // Path is the path of the file from the repository root.
744+ Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
745+ // Size is the size of the whole content in bytes.
746+ Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
747+ // Binary is true if the content is binary, with Git's rule: a NUL byte in the
748+ // first 8,000 bytes.
749+ Binary bool `protobuf:"varint,4,opt,name=binary,proto3" json:"binary,omitempty"`
750+ // MediaType is the detected media type, for example "text/plain" or
751+ // "image/png", from the file name and the first bytes. It is
752+ // "application/octet-stream" when unknown.
753+ MediaType string `protobuf:"bytes,5,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
754+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
755+ Mode uint32 `protobuf:"varint,6,opt,name=mode,proto3" json:"mode,omitempty"`
756+ unknownFields protoimpl.UnknownFields
757+ sizeCache protoimpl.SizeCache
758+}
759+
760+func (x *BlobInfo) Reset() {
761+ *x = BlobInfo{}
762+ mi := &file_ermite_git_proto_msgTypes[6]
763+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
764+ ms.StoreMessageInfo(mi)
765+}
766+
767+func (x *BlobInfo) String() string {
768+ return protoimpl.X.MessageStringOf(x)
769+}
770+
771+func (*BlobInfo) ProtoMessage() {}
772+
773+func (x *BlobInfo) ProtoReflect() protoreflect.Message {
774+ mi := &file_ermite_git_proto_msgTypes[6]
775+ if x != nil {
776+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
777+ if ms.LoadMessageInfo() == nil {
778+ ms.StoreMessageInfo(mi)
779+ }
780+ return ms
781+ }
782+ return mi.MessageOf(x)
783+}
784+
785+// Deprecated: Use BlobInfo.ProtoReflect.Descriptor instead.
786+func (*BlobInfo) Descriptor() ([]byte, []int) {
787+ return file_ermite_git_proto_rawDescGZIP(), []int{6}
788+}
789+
790+func (x *BlobInfo) GetId() string {
791+ if x != nil {
792+ return x.Id
793+ }
794+ return ""
795+}
796+
797+func (x *BlobInfo) GetPath() string {
798+ if x != nil {
799+ return x.Path
800+ }
801+ return ""
802+}
803+
804+func (x *BlobInfo) GetSize() int64 {
805+ if x != nil {
806+ return x.Size
807+ }
808+ return 0
809+}
810+
811+func (x *BlobInfo) GetBinary() bool {
812+ if x != nil {
813+ return x.Binary
814+ }
815+ return false
816+}
817+
818+func (x *BlobInfo) GetMediaType() string {
819+ if x != nil {
820+ return x.MediaType
821+ }
822+ return ""
823+}
824+
825+func (x *BlobInfo) GetMode() uint32 {
826+ if x != nil {
827+ return x.Mode
828+ }
829+ return 0
830+}
831+
832+// GetBlobRequest selects a file.
833+type GetBlobRequest struct {
834+ state protoimpl.MessageState `protogen:"open.v1"`
835+ // Repo is the repository name.
836+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
837+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
838+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
839+ // Path is the file, from the repository root. It is required.
840+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
841+ unknownFields protoimpl.UnknownFields
842+ sizeCache protoimpl.SizeCache
843+}
844+
845+func (x *GetBlobRequest) Reset() {
846+ *x = GetBlobRequest{}
847+ mi := &file_ermite_git_proto_msgTypes[7]
848+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
849+ ms.StoreMessageInfo(mi)
850+}
851+
852+func (x *GetBlobRequest) String() string {
853+ return protoimpl.X.MessageStringOf(x)
854+}
855+
856+func (*GetBlobRequest) ProtoMessage() {}
857+
858+func (x *GetBlobRequest) ProtoReflect() protoreflect.Message {
859+ mi := &file_ermite_git_proto_msgTypes[7]
860+ if x != nil {
861+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
862+ if ms.LoadMessageInfo() == nil {
863+ ms.StoreMessageInfo(mi)
864+ }
865+ return ms
866+ }
867+ return mi.MessageOf(x)
868+}
869+
870+// Deprecated: Use GetBlobRequest.ProtoReflect.Descriptor instead.
871+func (*GetBlobRequest) Descriptor() ([]byte, []int) {
872+ return file_ermite_git_proto_rawDescGZIP(), []int{7}
873+}
874+
875+func (x *GetBlobRequest) GetRepo() string {
876+ if x != nil {
877+ return x.Repo
878+ }
879+ return ""
880+}
881+
882+func (x *GetBlobRequest) GetRevision() string {
883+ if x != nil {
884+ return x.Revision
885+ }
886+ return ""
887+}
888+
889+func (x *GetBlobRequest) GetPath() string {
890+ if x != nil {
891+ return x.Path
892+ }
893+ return ""
894+}
895+
896+// GetBlobResponse is one message of the content stream.
897+type GetBlobResponse struct {
898+ state protoimpl.MessageState `protogen:"open.v1"`
899+ // Info describes the file. Set in the first message of the stream only.
900+ Info *BlobInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
901+ // Chunk is the next part of the content, at most 64 KiB, in order. The first
902+ // message may have an empty chunk. The chunks of a stream add up to
903+ // info.size bytes.
904+ Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"`
905+ unknownFields protoimpl.UnknownFields
906+ sizeCache protoimpl.SizeCache
907+}
908+
909+func (x *GetBlobResponse) Reset() {
910+ *x = GetBlobResponse{}
911+ mi := &file_ermite_git_proto_msgTypes[8]
912+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
913+ ms.StoreMessageInfo(mi)
914+}
915+
916+func (x *GetBlobResponse) String() string {
917+ return protoimpl.X.MessageStringOf(x)
918+}
919+
920+func (*GetBlobResponse) ProtoMessage() {}
921+
922+func (x *GetBlobResponse) ProtoReflect() protoreflect.Message {
923+ mi := &file_ermite_git_proto_msgTypes[8]
924+ if x != nil {
925+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
926+ if ms.LoadMessageInfo() == nil {
927+ ms.StoreMessageInfo(mi)
928+ }
929+ return ms
930+ }
931+ return mi.MessageOf(x)
932+}
933+
934+// Deprecated: Use GetBlobResponse.ProtoReflect.Descriptor instead.
935+func (*GetBlobResponse) Descriptor() ([]byte, []int) {
936+ return file_ermite_git_proto_rawDescGZIP(), []int{8}
937+}
938+
939+func (x *GetBlobResponse) GetInfo() *BlobInfo {
940+ if x != nil {
941+ return x.Info
942+ }
943+ return nil
944+}
945+
946+func (x *GetBlobResponse) GetChunk() []byte {
947+ if x != nil {
948+ return x.Chunk
949+ }
950+ return nil
951+}
952+
953+// ListCommitsRequest selects a page of history.
954+type ListCommitsRequest struct {
955+ state protoimpl.MessageState `protogen:"open.v1"`
956+ // Repo is the repository name.
957+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
958+ // Revision is where the history starts: a branch, a tag or a commit id.
959+ // Empty means HEAD.
960+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
961+ // Path restricts the result to the commits that changed this file or
962+ // directory. Empty means the whole history.
963+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
964+ // PageSize is the maximum number of commits to return. 0 means the server
965+ // default; values above 100 are lowered to 100.
966+ PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
967+ // PageToken is the next_page_token of a previous response, to continue the
968+ // same listing. Empty for the first page. Other fields must be unchanged.
969+ PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
970+ unknownFields protoimpl.UnknownFields
971+ sizeCache protoimpl.SizeCache
972+}
973+
974+func (x *ListCommitsRequest) Reset() {
975+ *x = ListCommitsRequest{}
976+ mi := &file_ermite_git_proto_msgTypes[9]
977+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
978+ ms.StoreMessageInfo(mi)
979+}
980+
981+func (x *ListCommitsRequest) String() string {
982+ return protoimpl.X.MessageStringOf(x)
983+}
984+
985+func (*ListCommitsRequest) ProtoMessage() {}
986+
987+func (x *ListCommitsRequest) ProtoReflect() protoreflect.Message {
988+ mi := &file_ermite_git_proto_msgTypes[9]
989+ if x != nil {
990+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
991+ if ms.LoadMessageInfo() == nil {
992+ ms.StoreMessageInfo(mi)
993+ }
994+ return ms
995+ }
996+ return mi.MessageOf(x)
997+}
998+
999+// Deprecated: Use ListCommitsRequest.ProtoReflect.Descriptor instead.
1000+func (*ListCommitsRequest) Descriptor() ([]byte, []int) {
1001+ return file_ermite_git_proto_rawDescGZIP(), []int{9}
1002+}
1003+
1004+func (x *ListCommitsRequest) GetRepo() string {
1005+ if x != nil {
1006+ return x.Repo
1007+ }
1008+ return ""
1009+}
1010+
1011+func (x *ListCommitsRequest) GetRevision() string {
1012+ if x != nil {
1013+ return x.Revision
1014+ }
1015+ return ""
1016+}
1017+
1018+func (x *ListCommitsRequest) GetPath() string {
1019+ if x != nil {
1020+ return x.Path
1021+ }
1022+ return ""
1023+}
1024+
1025+func (x *ListCommitsRequest) GetPageSize() int32 {
1026+ if x != nil {
1027+ return x.PageSize
1028+ }
1029+ return 0
1030+}
1031+
1032+func (x *ListCommitsRequest) GetPageToken() string {
1033+ if x != nil {
1034+ return x.PageToken
1035+ }
1036+ return ""
1037+}
1038+
1039+// ListCommitsResponse is one page of commits.
1040+type ListCommitsResponse struct {
1041+ state protoimpl.MessageState `protogen:"open.v1"`
1042+ // Commits are the commits of this page, newest first.
1043+ Commits []*Commit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"`
1044+ // NextPageToken is passed as page_token to get the next page. Empty when
1045+ // there is no next page.
1046+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
1047+ unknownFields protoimpl.UnknownFields
1048+ sizeCache protoimpl.SizeCache
1049+}
1050+
1051+func (x *ListCommitsResponse) Reset() {
1052+ *x = ListCommitsResponse{}
1053+ mi := &file_ermite_git_proto_msgTypes[10]
1054+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1055+ ms.StoreMessageInfo(mi)
1056+}
1057+
1058+func (x *ListCommitsResponse) String() string {
1059+ return protoimpl.X.MessageStringOf(x)
1060+}
1061+
1062+func (*ListCommitsResponse) ProtoMessage() {}
1063+
1064+func (x *ListCommitsResponse) ProtoReflect() protoreflect.Message {
1065+ mi := &file_ermite_git_proto_msgTypes[10]
1066+ if x != nil {
1067+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1068+ if ms.LoadMessageInfo() == nil {
1069+ ms.StoreMessageInfo(mi)
1070+ }
1071+ return ms
1072+ }
1073+ return mi.MessageOf(x)
1074+}
1075+
1076+// Deprecated: Use ListCommitsResponse.ProtoReflect.Descriptor instead.
1077+func (*ListCommitsResponse) Descriptor() ([]byte, []int) {
1078+ return file_ermite_git_proto_rawDescGZIP(), []int{10}
1079+}
1080+
1081+func (x *ListCommitsResponse) GetCommits() []*Commit {
1082+ if x != nil {
1083+ return x.Commits
1084+ }
1085+ return nil
1086+}
1087+
1088+func (x *ListCommitsResponse) GetNextPageToken() string {
1089+ if x != nil {
1090+ return x.NextPageToken
1091+ }
1092+ return ""
1093+}
1094+
1095+// GetCommitRequest selects a commit.
1096+type GetCommitRequest struct {
1097+ state protoimpl.MessageState `protogen:"open.v1"`
1098+ // Repo is the repository name.
1099+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
1100+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
1101+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
1102+ unknownFields protoimpl.UnknownFields
1103+ sizeCache protoimpl.SizeCache
1104+}
1105+
1106+func (x *GetCommitRequest) Reset() {
1107+ *x = GetCommitRequest{}
1108+ mi := &file_ermite_git_proto_msgTypes[11]
1109+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1110+ ms.StoreMessageInfo(mi)
1111+}
1112+
1113+func (x *GetCommitRequest) String() string {
1114+ return protoimpl.X.MessageStringOf(x)
1115+}
1116+
1117+func (*GetCommitRequest) ProtoMessage() {}
1118+
1119+func (x *GetCommitRequest) ProtoReflect() protoreflect.Message {
1120+ mi := &file_ermite_git_proto_msgTypes[11]
1121+ if x != nil {
1122+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1123+ if ms.LoadMessageInfo() == nil {
1124+ ms.StoreMessageInfo(mi)
1125+ }
1126+ return ms
1127+ }
1128+ return mi.MessageOf(x)
1129+}
1130+
1131+// Deprecated: Use GetCommitRequest.ProtoReflect.Descriptor instead.
1132+func (*GetCommitRequest) Descriptor() ([]byte, []int) {
1133+ return file_ermite_git_proto_rawDescGZIP(), []int{11}
1134+}
1135+
1136+func (x *GetCommitRequest) GetRepo() string {
1137+ if x != nil {
1138+ return x.Repo
1139+ }
1140+ return ""
1141+}
1142+
1143+func (x *GetCommitRequest) GetRevision() string {
1144+ if x != nil {
1145+ return x.Revision
1146+ }
1147+ return ""
1148+}
1149+
1150+// GetCommitResponse holds a commit, its statistics and its diff.
1151+type GetCommitResponse struct {
1152+ state protoimpl.MessageState `protogen:"open.v1"`
1153+ // Commit is the commit metadata.
1154+ Commit *Commit `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"`
1155+ // Stats are the totals over all the changed files, including files that the
1156+ // diff omits or truncates.
1157+ Stats *DiffStats `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
1158+ // Diff is the structured diff against the first parent, or against the empty
1159+ // tree for a root commit. For a merge commit this is the change relative to
1160+ // the first parent.
1161+ Diff *Diff `protobuf:"bytes,3,opt,name=diff,proto3" json:"diff,omitempty"`
1162+ unknownFields protoimpl.UnknownFields
1163+ sizeCache protoimpl.SizeCache
1164+}
1165+
1166+func (x *GetCommitResponse) Reset() {
1167+ *x = GetCommitResponse{}
1168+ mi := &file_ermite_git_proto_msgTypes[12]
1169+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1170+ ms.StoreMessageInfo(mi)
1171+}
1172+
1173+func (x *GetCommitResponse) String() string {
1174+ return protoimpl.X.MessageStringOf(x)
1175+}
1176+
1177+func (*GetCommitResponse) ProtoMessage() {}
1178+
1179+func (x *GetCommitResponse) ProtoReflect() protoreflect.Message {
1180+ mi := &file_ermite_git_proto_msgTypes[12]
1181+ if x != nil {
1182+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1183+ if ms.LoadMessageInfo() == nil {
1184+ ms.StoreMessageInfo(mi)
1185+ }
1186+ return ms
1187+ }
1188+ return mi.MessageOf(x)
1189+}
1190+
1191+// Deprecated: Use GetCommitResponse.ProtoReflect.Descriptor instead.
1192+func (*GetCommitResponse) Descriptor() ([]byte, []int) {
1193+ return file_ermite_git_proto_rawDescGZIP(), []int{12}
1194+}
1195+
1196+func (x *GetCommitResponse) GetCommit() *Commit {
1197+ if x != nil {
1198+ return x.Commit
1199+ }
1200+ return nil
1201+}
1202+
1203+func (x *GetCommitResponse) GetStats() *DiffStats {
1204+ if x != nil {
1205+ return x.Stats
1206+ }
1207+ return nil
1208+}
1209+
1210+func (x *GetCommitResponse) GetDiff() *Diff {
1211+ if x != nil {
1212+ return x.Diff
1213+ }
1214+ return nil
1215+}
1216+
1217+// DiffStats are the totals of a diff.
1218+type DiffStats struct {
1219+ state protoimpl.MessageState `protogen:"open.v1"`
1220+ // FilesChanged is the number of changed files.
1221+ FilesChanged int32 `protobuf:"varint,1,opt,name=files_changed,json=filesChanged,proto3" json:"files_changed,omitempty"`
1222+ // Additions is the number of added lines. Binary files count for 0.
1223+ Additions int32 `protobuf:"varint,2,opt,name=additions,proto3" json:"additions,omitempty"`
1224+ // Deletions is the number of deleted lines. Binary files count for 0.
1225+ Deletions int32 `protobuf:"varint,3,opt,name=deletions,proto3" json:"deletions,omitempty"`
1226+ unknownFields protoimpl.UnknownFields
1227+ sizeCache protoimpl.SizeCache
1228+}
1229+
1230+func (x *DiffStats) Reset() {
1231+ *x = DiffStats{}
1232+ mi := &file_ermite_git_proto_msgTypes[13]
1233+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1234+ ms.StoreMessageInfo(mi)
1235+}
1236+
1237+func (x *DiffStats) String() string {
1238+ return protoimpl.X.MessageStringOf(x)
1239+}
1240+
1241+func (*DiffStats) ProtoMessage() {}
1242+
1243+func (x *DiffStats) ProtoReflect() protoreflect.Message {
1244+ mi := &file_ermite_git_proto_msgTypes[13]
1245+ if x != nil {
1246+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1247+ if ms.LoadMessageInfo() == nil {
1248+ ms.StoreMessageInfo(mi)
1249+ }
1250+ return ms
1251+ }
1252+ return mi.MessageOf(x)
1253+}
1254+
1255+// Deprecated: Use DiffStats.ProtoReflect.Descriptor instead.
1256+func (*DiffStats) Descriptor() ([]byte, []int) {
1257+ return file_ermite_git_proto_rawDescGZIP(), []int{13}
1258+}
1259+
1260+func (x *DiffStats) GetFilesChanged() int32 {
1261+ if x != nil {
1262+ return x.FilesChanged
1263+ }
1264+ return 0
1265+}
1266+
1267+func (x *DiffStats) GetAdditions() int32 {
1268+ if x != nil {
1269+ return x.Additions
1270+ }
1271+ return 0
1272+}
1273+
1274+func (x *DiffStats) GetDeletions() int32 {
1275+ if x != nil {
1276+ return x.Deletions
1277+ }
1278+ return 0
1279+}
1280+
1281+// Diff is the structured difference introduced by a commit.
1282+//
1283+// The server limits its size: at most 300 files, at most 2,000 lines in one
1284+// file and at most 20,000 lines in total (hunk lines, context included). These
1285+// numbers are server behaviour and may change; clients must rely on the
1286+// truncated flags, not on the numbers.
1287+type Diff struct {
1288+ state protoimpl.MessageState `protogen:"open.v1"`
1289+ // Files are the changed files, ordered by path. Files past the file limit are
1290+ // omitted.
1291+ Files []*FileDiff `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
1292+ // Truncated is true when the diff is incomplete: files were omitted, or at
1293+ // least one listed file has truncated set. DiffStats still count everything.
1294+ Truncated bool `protobuf:"varint,2,opt,name=truncated,proto3" json:"truncated,omitempty"`
1295+ unknownFields protoimpl.UnknownFields
1296+ sizeCache protoimpl.SizeCache
1297+}
1298+
1299+func (x *Diff) Reset() {
1300+ *x = Diff{}
1301+ mi := &file_ermite_git_proto_msgTypes[14]
1302+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1303+ ms.StoreMessageInfo(mi)
1304+}
1305+
1306+func (x *Diff) String() string {
1307+ return protoimpl.X.MessageStringOf(x)
1308+}
1309+
1310+func (*Diff) ProtoMessage() {}
1311+
1312+func (x *Diff) ProtoReflect() protoreflect.Message {
1313+ mi := &file_ermite_git_proto_msgTypes[14]
1314+ if x != nil {
1315+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1316+ if ms.LoadMessageInfo() == nil {
1317+ ms.StoreMessageInfo(mi)
1318+ }
1319+ return ms
1320+ }
1321+ return mi.MessageOf(x)
1322+}
1323+
1324+// Deprecated: Use Diff.ProtoReflect.Descriptor instead.
1325+func (*Diff) Descriptor() ([]byte, []int) {
1326+ return file_ermite_git_proto_rawDescGZIP(), []int{14}
1327+}
1328+
1329+func (x *Diff) GetFiles() []*FileDiff {
1330+ if x != nil {
1331+ return x.Files
1332+ }
1333+ return nil
1334+}
1335+
1336+func (x *Diff) GetTruncated() bool {
1337+ if x != nil {
1338+ return x.Truncated
1339+ }
1340+ return false
1341+}
1342+
1343+// FileDiff is the change of one file.
1344+type FileDiff struct {
1345+ state protoimpl.MessageState `protogen:"open.v1"`
1346+ // OldPath is the path before the commit. Empty for an added file.
1347+ OldPath string `protobuf:"bytes,1,opt,name=old_path,json=oldPath,proto3" json:"old_path,omitempty"`
1348+ // NewPath is the path after the commit. Empty for a deleted file.
1349+ NewPath string `protobuf:"bytes,2,opt,name=new_path,json=newPath,proto3" json:"new_path,omitempty"`
1350+ // Status tells what happened to the file.
1351+ Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=ermite.FileStatus" json:"status,omitempty"`
1352+ // OldMode is the Git file mode before the commit, or 0 for an added file.
1353+ OldMode uint32 `protobuf:"varint,4,opt,name=old_mode,json=oldMode,proto3" json:"old_mode,omitempty"`
1354+ // NewMode is the Git file mode after the commit, or 0 for a deleted file.
1355+ NewMode uint32 `protobuf:"varint,5,opt,name=new_mode,json=newMode,proto3" json:"new_mode,omitempty"`
1356+ // OldId is the blob id before the commit. Empty for an added file.
1357+ OldId string `protobuf:"bytes,6,opt,name=old_id,json=oldId,proto3" json:"old_id,omitempty"`
1358+ // NewId is the blob id after the commit. Empty for a deleted file.
1359+ NewId string `protobuf:"bytes,7,opt,name=new_id,json=newId,proto3" json:"new_id,omitempty"`
1360+ // Binary is true if Git treats the file as binary (numstat reports "-"). A
1361+ // binary file has no hunks and additions and deletions are 0.
1362+ Binary bool `protobuf:"varint,8,opt,name=binary,proto3" json:"binary,omitempty"`
1363+ // Additions is the number of added lines.
1364+ Additions int32 `protobuf:"varint,9,opt,name=additions,proto3" json:"additions,omitempty"`
1365+ // Deletions is the number of deleted lines.
1366+ Deletions int32 `protobuf:"varint,10,opt,name=deletions,proto3" json:"deletions,omitempty"`
1367+ // Similarity is the percentage (0-100) of unchanged content for a renamed or
1368+ // copied file, and 0 otherwise.
1369+ Similarity int32 `protobuf:"varint,11,opt,name=similarity,proto3" json:"similarity,omitempty"`
1370+ // Truncated is true when the file exceeded a diff limit: hunks is then empty
1371+ // although the file changed. Additions and deletions remain accurate.
1372+ Truncated bool `protobuf:"varint,12,opt,name=truncated,proto3" json:"truncated,omitempty"`
1373+ // Hunks are the changed regions, in file order. Empty for a binary file, a
1374+ // truncated file, a pure rename and a mode-only change.
1375+ Hunks []*Hunk `protobuf:"bytes,13,rep,name=hunks,proto3" json:"hunks,omitempty"`
1376+ unknownFields protoimpl.UnknownFields
1377+ sizeCache protoimpl.SizeCache
1378+}
1379+
1380+func (x *FileDiff) Reset() {
1381+ *x = FileDiff{}
1382+ mi := &file_ermite_git_proto_msgTypes[15]
1383+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1384+ ms.StoreMessageInfo(mi)
1385+}
1386+
1387+func (x *FileDiff) String() string {
1388+ return protoimpl.X.MessageStringOf(x)
1389+}
1390+
1391+func (*FileDiff) ProtoMessage() {}
1392+
1393+func (x *FileDiff) ProtoReflect() protoreflect.Message {
1394+ mi := &file_ermite_git_proto_msgTypes[15]
1395+ if x != nil {
1396+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1397+ if ms.LoadMessageInfo() == nil {
1398+ ms.StoreMessageInfo(mi)
1399+ }
1400+ return ms
1401+ }
1402+ return mi.MessageOf(x)
1403+}
1404+
1405+// Deprecated: Use FileDiff.ProtoReflect.Descriptor instead.
1406+func (*FileDiff) Descriptor() ([]byte, []int) {
1407+ return file_ermite_git_proto_rawDescGZIP(), []int{15}
1408+}
1409+
1410+func (x *FileDiff) GetOldPath() string {
1411+ if x != nil {
1412+ return x.OldPath
1413+ }
1414+ return ""
1415+}
1416+
1417+func (x *FileDiff) GetNewPath() string {
1418+ if x != nil {
1419+ return x.NewPath
1420+ }
1421+ return ""
1422+}
1423+
1424+func (x *FileDiff) GetStatus() FileStatus {
1425+ if x != nil {
1426+ return x.Status
1427+ }
1428+ return FileStatus_FILE_STATUS_UNSPECIFIED
1429+}
1430+
1431+func (x *FileDiff) GetOldMode() uint32 {
1432+ if x != nil {
1433+ return x.OldMode
1434+ }
1435+ return 0
1436+}
1437+
1438+func (x *FileDiff) GetNewMode() uint32 {
1439+ if x != nil {
1440+ return x.NewMode
1441+ }
1442+ return 0
1443+}
1444+
1445+func (x *FileDiff) GetOldId() string {
1446+ if x != nil {
1447+ return x.OldId
1448+ }
1449+ return ""
1450+}
1451+
1452+func (x *FileDiff) GetNewId() string {
1453+ if x != nil {
1454+ return x.NewId
1455+ }
1456+ return ""
1457+}
1458+
1459+func (x *FileDiff) GetBinary() bool {
1460+ if x != nil {
1461+ return x.Binary
1462+ }
1463+ return false
1464+}
1465+
1466+func (x *FileDiff) GetAdditions() int32 {
1467+ if x != nil {
1468+ return x.Additions
1469+ }
1470+ return 0
1471+}
1472+
1473+func (x *FileDiff) GetDeletions() int32 {
1474+ if x != nil {
1475+ return x.Deletions
1476+ }
1477+ return 0
1478+}
1479+
1480+func (x *FileDiff) GetSimilarity() int32 {
1481+ if x != nil {
1482+ return x.Similarity
1483+ }
1484+ return 0
1485+}
1486+
1487+func (x *FileDiff) GetTruncated() bool {
1488+ if x != nil {
1489+ return x.Truncated
1490+ }
1491+ return false
1492+}
1493+
1494+func (x *FileDiff) GetHunks() []*Hunk {
1495+ if x != nil {
1496+ return x.Hunks
1497+ }
1498+ return nil
1499+}
1500+
1501+// Hunk is a contiguous changed region with its context.
1502+type Hunk struct {
1503+ state protoimpl.MessageState `protogen:"open.v1"`
1504+ // OldStart is the 1-based first line of the region in the old file. 0 when
1505+ // old_lines is 0 and the file was added.
1506+ OldStart int32 `protobuf:"varint,1,opt,name=old_start,json=oldStart,proto3" json:"old_start,omitempty"`
1507+ // OldLines is the number of old-side lines in the hunk.
1508+ OldLines int32 `protobuf:"varint,2,opt,name=old_lines,json=oldLines,proto3" json:"old_lines,omitempty"`
1509+ // NewStart is the 1-based first line of the region in the new file. 0 when
1510+ // new_lines is 0 and the file was deleted.
1511+ NewStart int32 `protobuf:"varint,3,opt,name=new_start,json=newStart,proto3" json:"new_start,omitempty"`
1512+ // NewLines is the number of new-side lines in the hunk.
1513+ NewLines int32 `protobuf:"varint,4,opt,name=new_lines,json=newLines,proto3" json:"new_lines,omitempty"`
1514+ // Header is the text after the second "@@" of the hunk header, usually the
1515+ // enclosing function. It may be empty.
1516+ Header string `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"`
1517+ // Lines are the lines of the hunk, in order.
1518+ Lines []*Line `protobuf:"bytes,6,rep,name=lines,proto3" json:"lines,omitempty"`
1519+ unknownFields protoimpl.UnknownFields
1520+ sizeCache protoimpl.SizeCache
1521+}
1522+
1523+func (x *Hunk) Reset() {
1524+ *x = Hunk{}
1525+ mi := &file_ermite_git_proto_msgTypes[16]
1526+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1527+ ms.StoreMessageInfo(mi)
1528+}
1529+
1530+func (x *Hunk) String() string {
1531+ return protoimpl.X.MessageStringOf(x)
1532+}
1533+
1534+func (*Hunk) ProtoMessage() {}
1535+
1536+func (x *Hunk) ProtoReflect() protoreflect.Message {
1537+ mi := &file_ermite_git_proto_msgTypes[16]
1538+ if x != nil {
1539+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1540+ if ms.LoadMessageInfo() == nil {
1541+ ms.StoreMessageInfo(mi)
1542+ }
1543+ return ms
1544+ }
1545+ return mi.MessageOf(x)
1546+}
1547+
1548+// Deprecated: Use Hunk.ProtoReflect.Descriptor instead.
1549+func (*Hunk) Descriptor() ([]byte, []int) {
1550+ return file_ermite_git_proto_rawDescGZIP(), []int{16}
1551+}
1552+
1553+func (x *Hunk) GetOldStart() int32 {
1554+ if x != nil {
1555+ return x.OldStart
1556+ }
1557+ return 0
1558+}
1559+
1560+func (x *Hunk) GetOldLines() int32 {
1561+ if x != nil {
1562+ return x.OldLines
1563+ }
1564+ return 0
1565+}
1566+
1567+func (x *Hunk) GetNewStart() int32 {
1568+ if x != nil {
1569+ return x.NewStart
1570+ }
1571+ return 0
1572+}
1573+
1574+func (x *Hunk) GetNewLines() int32 {
1575+ if x != nil {
1576+ return x.NewLines
1577+ }
1578+ return 0
1579+}
1580+
1581+func (x *Hunk) GetHeader() string {
1582+ if x != nil {
1583+ return x.Header
1584+ }
1585+ return ""
1586+}
1587+
1588+func (x *Hunk) GetLines() []*Line {
1589+ if x != nil {
1590+ return x.Lines
1591+ }
1592+ return nil
1593+}
1594+
1595+// Line is one line of a hunk.
1596+type Line struct {
1597+ state protoimpl.MessageState `protogen:"open.v1"`
1598+ // Kind tells which side the line belongs to.
1599+ Kind LineKind `protobuf:"varint,1,opt,name=kind,proto3,enum=ermite.LineKind" json:"kind,omitempty"`
1600+ // OldNumber is the 1-based line number on the old side. 0 for an addition.
1601+ OldNumber int32 `protobuf:"varint,2,opt,name=old_number,json=oldNumber,proto3" json:"old_number,omitempty"`
1602+ // NewNumber is the 1-based line number on the new side. 0 for a deletion.
1603+ NewNumber int32 `protobuf:"varint,3,opt,name=new_number,json=newNumber,proto3" json:"new_number,omitempty"`
1604+ // Text is the content without the line terminator. Bytes that are not valid
1605+ // UTF-8 are replaced by the replacement character.
1606+ Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
1607+ // NoNewlineAtEof is true when this is the last line of its side and the file
1608+ // does not end with a line break there.
1609+ NoNewlineAtEof bool `protobuf:"varint,5,opt,name=no_newline_at_eof,json=noNewlineAtEof,proto3" json:"no_newline_at_eof,omitempty"`
1610+ unknownFields protoimpl.UnknownFields
1611+ sizeCache protoimpl.SizeCache
1612+}
1613+
1614+func (x *Line) Reset() {
1615+ *x = Line{}
1616+ mi := &file_ermite_git_proto_msgTypes[17]
1617+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1618+ ms.StoreMessageInfo(mi)
1619+}
1620+
1621+func (x *Line) String() string {
1622+ return protoimpl.X.MessageStringOf(x)
1623+}
1624+
1625+func (*Line) ProtoMessage() {}
1626+
1627+func (x *Line) ProtoReflect() protoreflect.Message {
1628+ mi := &file_ermite_git_proto_msgTypes[17]
1629+ if x != nil {
1630+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1631+ if ms.LoadMessageInfo() == nil {
1632+ ms.StoreMessageInfo(mi)
1633+ }
1634+ return ms
1635+ }
1636+ return mi.MessageOf(x)
1637+}
1638+
1639+// Deprecated: Use Line.ProtoReflect.Descriptor instead.
1640+func (*Line) Descriptor() ([]byte, []int) {
1641+ return file_ermite_git_proto_rawDescGZIP(), []int{17}
1642+}
1643+
1644+func (x *Line) GetKind() LineKind {
1645+ if x != nil {
1646+ return x.Kind
1647+ }
1648+ return LineKind_LINE_KIND_UNSPECIFIED
1649+}
1650+
1651+func (x *Line) GetOldNumber() int32 {
1652+ if x != nil {
1653+ return x.OldNumber
1654+ }
1655+ return 0
1656+}
1657+
1658+func (x *Line) GetNewNumber() int32 {
1659+ if x != nil {
1660+ return x.NewNumber
1661+ }
1662+ return 0
1663+}
1664+
1665+func (x *Line) GetText() string {
1666+ if x != nil {
1667+ return x.Text
1668+ }
1669+ return ""
1670+}
1671+
1672+func (x *Line) GetNoNewlineAtEof() bool {
1673+ if x != nil {
1674+ return x.NoNewlineAtEof
1675+ }
1676+ return false
1677+}
1678+
1679+// ResolveRevisionRequest names a revision.
1680+type ResolveRevisionRequest struct {
1681+ state protoimpl.MessageState `protogen:"open.v1"`
1682+ // Repo is the repository name.
1683+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
1684+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
1685+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
1686+ unknownFields protoimpl.UnknownFields
1687+ sizeCache protoimpl.SizeCache
1688+}
1689+
1690+func (x *ResolveRevisionRequest) Reset() {
1691+ *x = ResolveRevisionRequest{}
1692+ mi := &file_ermite_git_proto_msgTypes[18]
1693+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1694+ ms.StoreMessageInfo(mi)
1695+}
1696+
1697+func (x *ResolveRevisionRequest) String() string {
1698+ return protoimpl.X.MessageStringOf(x)
1699+}
1700+
1701+func (*ResolveRevisionRequest) ProtoMessage() {}
1702+
1703+func (x *ResolveRevisionRequest) ProtoReflect() protoreflect.Message {
1704+ mi := &file_ermite_git_proto_msgTypes[18]
1705+ if x != nil {
1706+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1707+ if ms.LoadMessageInfo() == nil {
1708+ ms.StoreMessageInfo(mi)
1709+ }
1710+ return ms
1711+ }
1712+ return mi.MessageOf(x)
1713+}
1714+
1715+// Deprecated: Use ResolveRevisionRequest.ProtoReflect.Descriptor instead.
1716+func (*ResolveRevisionRequest) Descriptor() ([]byte, []int) {
1717+ return file_ermite_git_proto_rawDescGZIP(), []int{18}
1718+}
1719+
1720+func (x *ResolveRevisionRequest) GetRepo() string {
1721+ if x != nil {
1722+ return x.Repo
1723+ }
1724+ return ""
1725+}
1726+
1727+func (x *ResolveRevisionRequest) GetRevision() string {
1728+ if x != nil {
1729+ return x.Revision
1730+ }
1731+ return ""
1732+}
1733+
1734+// ResolveRevisionResponse holds the resolved commit.
1735+type ResolveRevisionResponse struct {
1736+ state protoimpl.MessageState `protogen:"open.v1"`
1737+ // CommitId is the full id of the commit the revision designates, after
1738+ // following annotated tags.
1739+ CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
1740+ // Ref is the full name of the ref the revision matched, for example
1741+ // "refs/heads/main". Empty when the revision was a commit id or for HEAD
1742+ // when it is resolved by default.
1743+ Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
1744+ unknownFields protoimpl.UnknownFields
1745+ sizeCache protoimpl.SizeCache
1746+}
1747+
1748+func (x *ResolveRevisionResponse) Reset() {
1749+ *x = ResolveRevisionResponse{}
1750+ mi := &file_ermite_git_proto_msgTypes[19]
1751+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1752+ ms.StoreMessageInfo(mi)
1753+}
1754+
1755+func (x *ResolveRevisionResponse) String() string {
1756+ return protoimpl.X.MessageStringOf(x)
1757+}
1758+
1759+func (*ResolveRevisionResponse) ProtoMessage() {}
1760+
1761+func (x *ResolveRevisionResponse) ProtoReflect() protoreflect.Message {
1762+ mi := &file_ermite_git_proto_msgTypes[19]
1763+ if x != nil {
1764+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1765+ if ms.LoadMessageInfo() == nil {
1766+ ms.StoreMessageInfo(mi)
1767+ }
1768+ return ms
1769+ }
1770+ return mi.MessageOf(x)
1771+}
1772+
1773+// Deprecated: Use ResolveRevisionResponse.ProtoReflect.Descriptor instead.
1774+func (*ResolveRevisionResponse) Descriptor() ([]byte, []int) {
1775+ return file_ermite_git_proto_rawDescGZIP(), []int{19}
1776+}
1777+
1778+func (x *ResolveRevisionResponse) GetCommitId() string {
1779+ if x != nil {
1780+ return x.CommitId
1781+ }
1782+ return ""
1783+}
1784+
1785+func (x *ResolveRevisionResponse) GetRef() string {
1786+ if x != nil {
1787+ return x.Ref
1788+ }
1789+ return ""
1790+}
1791+
1792+var File_ermite_git_proto protoreflect.FileDescriptor
1793+
1794+const file_ermite_git_proto_rawDesc = "" +
1795+ "\n" +
1796+ "\x10ermite/git.proto\x12\x06ermite\x1a\x12ermite/types.proto\"\x8a\x01\n" +
1797+ "\x03Ref\x12\x12\n" +
1798+ "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" +
1799+ "\n" +
1800+ "short_name\x18\x02 \x01(\tR\tshortName\x12#\n" +
1801+ "\x04kind\x18\x03 \x01(\x0e2\x0f.ermite.RefKindR\x04kind\x12\x0e\n" +
1802+ "\x02id\x18\x04 \x01(\tR\x02id\x12\x1b\n" +
1803+ "\tcommit_id\x18\x05 \x01(\tR\bcommitId\"\x88\x01\n" +
1804+ "\x0fListRefsRequest\x12\x12\n" +
1805+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12%\n" +
1806+ "\x05kinds\x18\x02 \x03(\x0e2\x0f.ermite.RefKindR\x05kinds\x12\x1b\n" +
1807+ "\tpage_size\x18\x03 \x01(\x05R\bpageSize\x12\x1d\n" +
1808+ "\n" +
1809+ "page_token\x18\x04 \x01(\tR\tpageToken\"[\n" +
1810+ "\x10ListRefsResponse\x12\x1f\n" +
1811+ "\x04refs\x18\x01 \x03(\v2\v.ermite.RefR\x04refs\x12&\n" +
1812+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xc3\x01\n" +
1813+ "\tTreeEntry\x12\x12\n" +
1814+ "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
1815+ "\x04path\x18\x02 \x01(\tR\x04path\x12%\n" +
1816+ "\x04kind\x18\x03 \x01(\x0e2\x11.ermite.EntryKindR\x04kind\x12\x12\n" +
1817+ "\x04mode\x18\x04 \x01(\rR\x04mode\x12\x0e\n" +
1818+ "\x02id\x18\x05 \x01(\tR\x02id\x12\x12\n" +
1819+ "\x04size\x18\x06 \x01(\x03R\x04size\x12/\n" +
1820+ "\vlast_commit\x18\a \x01(\v2\x0e.ermite.CommitR\n" +
1821+ "lastCommit\"\x84\x01\n" +
1822+ "\x0eGetTreeRequest\x12\x12\n" +
1823+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1824+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1825+ "\x04path\x18\x03 \x01(\tR\x04path\x12.\n" +
1826+ "\x13include_last_commit\x18\x04 \x01(\bR\x11includeLastCommit\"t\n" +
1827+ "\x0fGetTreeResponse\x12\x1b\n" +
1828+ "\tcommit_id\x18\x01 \x01(\tR\bcommitId\x12\x17\n" +
1829+ "\atree_id\x18\x02 \x01(\tR\x06treeId\x12+\n" +
1830+ "\aentries\x18\x03 \x03(\v2\x11.ermite.TreeEntryR\aentries\"\x8d\x01\n" +
1831+ "\bBlobInfo\x12\x0e\n" +
1832+ "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
1833+ "\x04path\x18\x02 \x01(\tR\x04path\x12\x12\n" +
1834+ "\x04size\x18\x03 \x01(\x03R\x04size\x12\x16\n" +
1835+ "\x06binary\x18\x04 \x01(\bR\x06binary\x12\x1d\n" +
1836+ "\n" +
1837+ "media_type\x18\x05 \x01(\tR\tmediaType\x12\x12\n" +
1838+ "\x04mode\x18\x06 \x01(\rR\x04mode\"T\n" +
1839+ "\x0eGetBlobRequest\x12\x12\n" +
1840+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1841+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1842+ "\x04path\x18\x03 \x01(\tR\x04path\"M\n" +
1843+ "\x0fGetBlobResponse\x12$\n" +
1844+ "\x04info\x18\x01 \x01(\v2\x10.ermite.BlobInfoR\x04info\x12\x14\n" +
1845+ "\x05chunk\x18\x02 \x01(\fR\x05chunk\"\x94\x01\n" +
1846+ "\x12ListCommitsRequest\x12\x12\n" +
1847+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1848+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1849+ "\x04path\x18\x03 \x01(\tR\x04path\x12\x1b\n" +
1850+ "\tpage_size\x18\x04 \x01(\x05R\bpageSize\x12\x1d\n" +
1851+ "\n" +
1852+ "page_token\x18\x05 \x01(\tR\tpageToken\"g\n" +
1853+ "\x13ListCommitsResponse\x12(\n" +
1854+ "\acommits\x18\x01 \x03(\v2\x0e.ermite.CommitR\acommits\x12&\n" +
1855+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"B\n" +
1856+ "\x10GetCommitRequest\x12\x12\n" +
1857+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1858+ "\brevision\x18\x02 \x01(\tR\brevision\"\x86\x01\n" +
1859+ "\x11GetCommitResponse\x12&\n" +
1860+ "\x06commit\x18\x01 \x01(\v2\x0e.ermite.CommitR\x06commit\x12'\n" +
1861+ "\x05stats\x18\x02 \x01(\v2\x11.ermite.DiffStatsR\x05stats\x12 \n" +
1862+ "\x04diff\x18\x03 \x01(\v2\f.ermite.DiffR\x04diff\"l\n" +
1863+ "\tDiffStats\x12#\n" +
1864+ "\rfiles_changed\x18\x01 \x01(\x05R\ffilesChanged\x12\x1c\n" +
1865+ "\tadditions\x18\x02 \x01(\x05R\tadditions\x12\x1c\n" +
1866+ "\tdeletions\x18\x03 \x01(\x05R\tdeletions\"L\n" +
1867+ "\x04Diff\x12&\n" +
1868+ "\x05files\x18\x01 \x03(\v2\x10.ermite.FileDiffR\x05files\x12\x1c\n" +
1869+ "\ttruncated\x18\x02 \x01(\bR\ttruncated\"\x86\x03\n" +
1870+ "\bFileDiff\x12\x19\n" +
1871+ "\bold_path\x18\x01 \x01(\tR\aoldPath\x12\x19\n" +
1872+ "\bnew_path\x18\x02 \x01(\tR\anewPath\x12*\n" +
1873+ "\x06status\x18\x03 \x01(\x0e2\x12.ermite.FileStatusR\x06status\x12\x19\n" +
1874+ "\bold_mode\x18\x04 \x01(\rR\aoldMode\x12\x19\n" +
1875+ "\bnew_mode\x18\x05 \x01(\rR\anewMode\x12\x15\n" +
1876+ "\x06old_id\x18\x06 \x01(\tR\x05oldId\x12\x15\n" +
1877+ "\x06new_id\x18\a \x01(\tR\x05newId\x12\x16\n" +
1878+ "\x06binary\x18\b \x01(\bR\x06binary\x12\x1c\n" +
1879+ "\tadditions\x18\t \x01(\x05R\tadditions\x12\x1c\n" +
1880+ "\tdeletions\x18\n" +
1881+ " \x01(\x05R\tdeletions\x12\x1e\n" +
1882+ "\n" +
1883+ "similarity\x18\v \x01(\x05R\n" +
1884+ "similarity\x12\x1c\n" +
1885+ "\ttruncated\x18\f \x01(\bR\ttruncated\x12\"\n" +
1886+ "\x05hunks\x18\r \x03(\v2\f.ermite.HunkR\x05hunks\"\xb6\x01\n" +
1887+ "\x04Hunk\x12\x1b\n" +
1888+ "\told_start\x18\x01 \x01(\x05R\boldStart\x12\x1b\n" +
1889+ "\told_lines\x18\x02 \x01(\x05R\boldLines\x12\x1b\n" +
1890+ "\tnew_start\x18\x03 \x01(\x05R\bnewStart\x12\x1b\n" +
1891+ "\tnew_lines\x18\x04 \x01(\x05R\bnewLines\x12\x16\n" +
1892+ "\x06header\x18\x05 \x01(\tR\x06header\x12\"\n" +
1893+ "\x05lines\x18\x06 \x03(\v2\f.ermite.LineR\x05lines\"\xa9\x01\n" +
1894+ "\x04Line\x12$\n" +
1895+ "\x04kind\x18\x01 \x01(\x0e2\x10.ermite.LineKindR\x04kind\x12\x1d\n" +
1896+ "\n" +
1897+ "old_number\x18\x02 \x01(\x05R\toldNumber\x12\x1d\n" +
1898+ "\n" +
1899+ "new_number\x18\x03 \x01(\x05R\tnewNumber\x12\x12\n" +
1900+ "\x04text\x18\x04 \x01(\tR\x04text\x12)\n" +
1901+ "\x11no_newline_at_eof\x18\x05 \x01(\bR\x0enoNewlineAtEof\"H\n" +
1902+ "\x16ResolveRevisionRequest\x12\x12\n" +
1903+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1904+ "\brevision\x18\x02 \x01(\tR\brevision\"H\n" +
1905+ "\x17ResolveRevisionResponse\x12\x1b\n" +
1906+ "\tcommit_id\x18\x01 \x01(\tR\bcommitId\x12\x10\n" +
1907+ "\x03ref\x18\x02 \x01(\tR\x03ref*]\n" +
1908+ "\aRefKind\x12\x18\n" +
1909+ "\x14REF_KIND_UNSPECIFIED\x10\x00\x12\x13\n" +
1910+ "\x0fREF_KIND_BRANCH\x10\x01\x12\x10\n" +
1911+ "\fREF_KIND_TAG\x10\x02\x12\x11\n" +
1912+ "\rREF_KIND_HEAD\x10\x03*\xa3\x01\n" +
1913+ "\tEntryKind\x12\x1a\n" +
1914+ "\x16ENTRY_KIND_UNSPECIFIED\x10\x00\x12\x13\n" +
1915+ "\x0fENTRY_KIND_FILE\x10\x01\x12\x19\n" +
1916+ "\x15ENTRY_KIND_EXECUTABLE\x10\x02\x12\x18\n" +
1917+ "\x14ENTRY_KIND_DIRECTORY\x10\x03\x12\x16\n" +
1918+ "\x12ENTRY_KIND_SYMLINK\x10\x04\x12\x18\n" +
1919+ "\x14ENTRY_KIND_SUBMODULE\x10\x05*\xc2\x01\n" +
1920+ "\n" +
1921+ "FileStatus\x12\x1b\n" +
1922+ "\x17FILE_STATUS_UNSPECIFIED\x10\x00\x12\x15\n" +
1923+ "\x11FILE_STATUS_ADDED\x10\x01\x12\x17\n" +
1924+ "\x13FILE_STATUS_DELETED\x10\x02\x12\x18\n" +
1925+ "\x14FILE_STATUS_MODIFIED\x10\x03\x12\x17\n" +
1926+ "\x13FILE_STATUS_RENAMED\x10\x04\x12\x16\n" +
1927+ "\x12FILE_STATUS_COPIED\x10\x05\x12\x1c\n" +
1928+ "\x18FILE_STATUS_TYPE_CHANGED\x10\x06*l\n" +
1929+ "\bLineKind\x12\x19\n" +
1930+ "\x15LINE_KIND_UNSPECIFIED\x10\x00\x12\x15\n" +
1931+ "\x11LINE_KIND_CONTEXT\x10\x01\x12\x16\n" +
1932+ "\x12LINE_KIND_ADDITION\x10\x02\x12\x16\n" +
1933+ "\x12LINE_KIND_DELETION\x10\x032\xa3\x03\n" +
1934+ "\n" +
1935+ "GitService\x12=\n" +
1936+ "\bListRefs\x12\x17.ermite.ListRefsRequest\x1a\x18.ermite.ListRefsResponse\x12:\n" +
1937+ "\aGetTree\x12\x16.ermite.GetTreeRequest\x1a\x17.ermite.GetTreeResponse\x12<\n" +
1938+ "\aGetBlob\x12\x16.ermite.GetBlobRequest\x1a\x17.ermite.GetBlobResponse0\x01\x12F\n" +
1939+ "\vListCommits\x12\x1a.ermite.ListCommitsRequest\x1a\x1b.ermite.ListCommitsResponse\x12@\n" +
1940+ "\tGetCommit\x12\x18.ermite.GetCommitRequest\x1a\x19.ermite.GetCommitResponse\x12R\n" +
1941+ "\x0fResolveRevision\x12\x1e.ermite.ResolveRevisionRequest\x1a\x1f.ermite.ResolveRevisionResponseBo\n" +
1942+ "\n" +
1943+ "com.ermiteB\bGitProtoP\x01Z\x1fbnema.dev/ermite-api/gen/ermite\xa2\x02\x03EXX\xaa\x02\x06Ermite\xca\x02\x06Ermite\xe2\x02\x12Ermite\\GPBMetadata\xea\x02\x06Ermiteb\x06proto3"
1944+
1945+var (
1946+ file_ermite_git_proto_rawDescOnce sync.Once
1947+ file_ermite_git_proto_rawDescData []byte
1948+)
1949+
1950+func file_ermite_git_proto_rawDescGZIP() []byte {
1951+ file_ermite_git_proto_rawDescOnce.Do(func() {
1952+ file_ermite_git_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ermite_git_proto_rawDesc), len(file_ermite_git_proto_rawDesc)))
1953+ })
1954+ return file_ermite_git_proto_rawDescData
1955+}
1956+
1957+var file_ermite_git_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
1958+var file_ermite_git_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
1959+var file_ermite_git_proto_goTypes = []any{
1960+ (RefKind)(0), // 0: ermite.RefKind
1961+ (EntryKind)(0), // 1: ermite.EntryKind
1962+ (FileStatus)(0), // 2: ermite.FileStatus
1963+ (LineKind)(0), // 3: ermite.LineKind
1964+ (*Ref)(nil), // 4: ermite.Ref
1965+ (*ListRefsRequest)(nil), // 5: ermite.ListRefsRequest
1966+ (*ListRefsResponse)(nil), // 6: ermite.ListRefsResponse
1967+ (*TreeEntry)(nil), // 7: ermite.TreeEntry
1968+ (*GetTreeRequest)(nil), // 8: ermite.GetTreeRequest
1969+ (*GetTreeResponse)(nil), // 9: ermite.GetTreeResponse
1970+ (*BlobInfo)(nil), // 10: ermite.BlobInfo
1971+ (*GetBlobRequest)(nil), // 11: ermite.GetBlobRequest
1972+ (*GetBlobResponse)(nil), // 12: ermite.GetBlobResponse
1973+ (*ListCommitsRequest)(nil), // 13: ermite.ListCommitsRequest
1974+ (*ListCommitsResponse)(nil), // 14: ermite.ListCommitsResponse
1975+ (*GetCommitRequest)(nil), // 15: ermite.GetCommitRequest
1976+ (*GetCommitResponse)(nil), // 16: ermite.GetCommitResponse
1977+ (*DiffStats)(nil), // 17: ermite.DiffStats
1978+ (*Diff)(nil), // 18: ermite.Diff
1979+ (*FileDiff)(nil), // 19: ermite.FileDiff
1980+ (*Hunk)(nil), // 20: ermite.Hunk
1981+ (*Line)(nil), // 21: ermite.Line
1982+ (*ResolveRevisionRequest)(nil), // 22: ermite.ResolveRevisionRequest
1983+ (*ResolveRevisionResponse)(nil), // 23: ermite.ResolveRevisionResponse
1984+ (*Commit)(nil), // 24: ermite.Commit
1985+}
1986+var file_ermite_git_proto_depIdxs = []int32{
1987+ 0, // 0: ermite.Ref.kind:type_name -> ermite.RefKind
1988+ 0, // 1: ermite.ListRefsRequest.kinds:type_name -> ermite.RefKind
1989+ 4, // 2: ermite.ListRefsResponse.refs:type_name -> ermite.Ref
1990+ 1, // 3: ermite.TreeEntry.kind:type_name -> ermite.EntryKind
1991+ 24, // 4: ermite.TreeEntry.last_commit:type_name -> ermite.Commit
1992+ 7, // 5: ermite.GetTreeResponse.entries:type_name -> ermite.TreeEntry
1993+ 10, // 6: ermite.GetBlobResponse.info:type_name -> ermite.BlobInfo
1994+ 24, // 7: ermite.ListCommitsResponse.commits:type_name -> ermite.Commit
1995+ 24, // 8: ermite.GetCommitResponse.commit:type_name -> ermite.Commit
1996+ 17, // 9: ermite.GetCommitResponse.stats:type_name -> ermite.DiffStats
1997+ 18, // 10: ermite.GetCommitResponse.diff:type_name -> ermite.Diff
1998+ 19, // 11: ermite.Diff.files:type_name -> ermite.FileDiff
1999+ 2, // 12: ermite.FileDiff.status:type_name -> ermite.FileStatus
2000+ 20, // 13: ermite.FileDiff.hunks:type_name -> ermite.Hunk
2001+ 21, // 14: ermite.Hunk.lines:type_name -> ermite.Line
2002+ 3, // 15: ermite.Line.kind:type_name -> ermite.LineKind
2003+ 5, // 16: ermite.GitService.ListRefs:input_type -> ermite.ListRefsRequest
2004+ 8, // 17: ermite.GitService.GetTree:input_type -> ermite.GetTreeRequest
2005+ 11, // 18: ermite.GitService.GetBlob:input_type -> ermite.GetBlobRequest
2006+ 13, // 19: ermite.GitService.ListCommits:input_type -> ermite.ListCommitsRequest
2007+ 15, // 20: ermite.GitService.GetCommit:input_type -> ermite.GetCommitRequest
2008+ 22, // 21: ermite.GitService.ResolveRevision:input_type -> ermite.ResolveRevisionRequest
2009+ 6, // 22: ermite.GitService.ListRefs:output_type -> ermite.ListRefsResponse
2010+ 9, // 23: ermite.GitService.GetTree:output_type -> ermite.GetTreeResponse
2011+ 12, // 24: ermite.GitService.GetBlob:output_type -> ermite.GetBlobResponse
2012+ 14, // 25: ermite.GitService.ListCommits:output_type -> ermite.ListCommitsResponse
2013+ 16, // 26: ermite.GitService.GetCommit:output_type -> ermite.GetCommitResponse
2014+ 23, // 27: ermite.GitService.ResolveRevision:output_type -> ermite.ResolveRevisionResponse
2015+ 22, // [22:28] is the sub-list for method output_type
2016+ 16, // [16:22] is the sub-list for method input_type
2017+ 16, // [16:16] is the sub-list for extension type_name
2018+ 16, // [16:16] is the sub-list for extension extendee
2019+ 0, // [0:16] is the sub-list for field type_name
2020+}
2021+
2022+func init() { file_ermite_git_proto_init() }
2023+func file_ermite_git_proto_init() {
2024+ if File_ermite_git_proto != nil {
2025+ return
2026+ }
2027+ file_ermite_types_proto_init()
2028+ type x struct{}
2029+ out := protoimpl.TypeBuilder{
2030+ File: protoimpl.DescBuilder{
2031+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
2032+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_ermite_git_proto_rawDesc), len(file_ermite_git_proto_rawDesc)),
2033+ NumEnums: 4,
2034+ NumMessages: 20,
2035+ NumExtensions: 0,
2036+ NumServices: 1,
2037+ },
2038+ GoTypes: file_ermite_git_proto_goTypes,
2039+ DependencyIndexes: file_ermite_git_proto_depIdxs,
2040+ EnumInfos: file_ermite_git_proto_enumTypes,
2041+ MessageInfos: file_ermite_git_proto_msgTypes,
2042+ }.Build()
2043+ File_ermite_git_proto = out.File
2044+ file_ermite_git_proto_goTypes = nil
2045+ file_ermite_git_proto_depIdxs = nil
2046+}
@@ -0,0 +1,2046 @@
1+// SPDX-License-Identifier: MIT
2+
3+// Code generated by protoc-gen-go. DO NOT EDIT.
4+// versions:
5+// protoc-gen-go v1.36.12
6+// protoc (unknown)
7+// source: ermite/git.proto
8+
9+package ermite
10+
11+import (
12+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
13+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
14+ reflect "reflect"
15+ sync "sync"
16+ unsafe "unsafe"
17+)
18+
19+const (
20+ // Verify that this generated code is sufficiently up-to-date.
21+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
22+ // Verify that runtime/protoimpl is sufficiently up-to-date.
23+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
24+)
25+
26+// RefKind is the kind of a Git ref.
27+type RefKind int32
28+
29+const (
30+ // Not set. In ListRefsRequest.kinds it is rejected; never returned.
31+ RefKind_REF_KIND_UNSPECIFIED RefKind = 0
32+ // A branch (refs/heads/*).
33+ RefKind_REF_KIND_BRANCH RefKind = 1
34+ // A tag (refs/tags/*), lightweight or annotated.
35+ RefKind_REF_KIND_TAG RefKind = 2
36+ // The symbolic ref HEAD, that is the default branch.
37+ RefKind_REF_KIND_HEAD RefKind = 3
38+)
39+
40+// Enum value maps for RefKind.
41+var (
42+ RefKind_name = map[int32]string{
43+ 0: "REF_KIND_UNSPECIFIED",
44+ 1: "REF_KIND_BRANCH",
45+ 2: "REF_KIND_TAG",
46+ 3: "REF_KIND_HEAD",
47+ }
48+ RefKind_value = map[string]int32{
49+ "REF_KIND_UNSPECIFIED": 0,
50+ "REF_KIND_BRANCH": 1,
51+ "REF_KIND_TAG": 2,
52+ "REF_KIND_HEAD": 3,
53+ }
54+)
55+
56+func (x RefKind) Enum() *RefKind {
57+ p := new(RefKind)
58+ *p = x
59+ return p
60+}
61+
62+func (x RefKind) String() string {
63+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
64+}
65+
66+func (RefKind) Descriptor() protoreflect.EnumDescriptor {
67+ return file_ermite_git_proto_enumTypes[0].Descriptor()
68+}
69+
70+func (RefKind) Type() protoreflect.EnumType {
71+ return &file_ermite_git_proto_enumTypes[0]
72+}
73+
74+func (x RefKind) Number() protoreflect.EnumNumber {
75+ return protoreflect.EnumNumber(x)
76+}
77+
78+// Deprecated: Use RefKind.Descriptor instead.
79+func (RefKind) EnumDescriptor() ([]byte, []int) {
80+ return file_ermite_git_proto_rawDescGZIP(), []int{0}
81+}
82+
83+// EntryKind is the kind of an entry of a Git tree.
84+type EntryKind int32
85+
86+const (
87+ // Not set. Never returned.
88+ EntryKind_ENTRY_KIND_UNSPECIFIED EntryKind = 0
89+ // A regular, non-executable file (mode 100644).
90+ EntryKind_ENTRY_KIND_FILE EntryKind = 1
91+ // An executable file (mode 100755).
92+ EntryKind_ENTRY_KIND_EXECUTABLE EntryKind = 2
93+ // A directory (mode 040000).
94+ EntryKind_ENTRY_KIND_DIRECTORY EntryKind = 3
95+ // A symbolic link (mode 120000). The blob content is the link target.
96+ EntryKind_ENTRY_KIND_SYMLINK EntryKind = 4
97+ // A submodule commit (mode 160000). The id is a commit of another
98+ // repository, which this one does not contain.
99+ EntryKind_ENTRY_KIND_SUBMODULE EntryKind = 5
100+)
101+
102+// Enum value maps for EntryKind.
103+var (
104+ EntryKind_name = map[int32]string{
105+ 0: "ENTRY_KIND_UNSPECIFIED",
106+ 1: "ENTRY_KIND_FILE",
107+ 2: "ENTRY_KIND_EXECUTABLE",
108+ 3: "ENTRY_KIND_DIRECTORY",
109+ 4: "ENTRY_KIND_SYMLINK",
110+ 5: "ENTRY_KIND_SUBMODULE",
111+ }
112+ EntryKind_value = map[string]int32{
113+ "ENTRY_KIND_UNSPECIFIED": 0,
114+ "ENTRY_KIND_FILE": 1,
115+ "ENTRY_KIND_EXECUTABLE": 2,
116+ "ENTRY_KIND_DIRECTORY": 3,
117+ "ENTRY_KIND_SYMLINK": 4,
118+ "ENTRY_KIND_SUBMODULE": 5,
119+ }
120+)
121+
122+func (x EntryKind) Enum() *EntryKind {
123+ p := new(EntryKind)
124+ *p = x
125+ return p
126+}
127+
128+func (x EntryKind) String() string {
129+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
130+}
131+
132+func (EntryKind) Descriptor() protoreflect.EnumDescriptor {
133+ return file_ermite_git_proto_enumTypes[1].Descriptor()
134+}
135+
136+func (EntryKind) Type() protoreflect.EnumType {
137+ return &file_ermite_git_proto_enumTypes[1]
138+}
139+
140+func (x EntryKind) Number() protoreflect.EnumNumber {
141+ return protoreflect.EnumNumber(x)
142+}
143+
144+// Deprecated: Use EntryKind.Descriptor instead.
145+func (EntryKind) EnumDescriptor() ([]byte, []int) {
146+ return file_ermite_git_proto_rawDescGZIP(), []int{1}
147+}
148+
149+// FileStatus tells what a commit did to a file.
150+type FileStatus int32
151+
152+const (
153+ // Not set. Never returned.
154+ FileStatus_FILE_STATUS_UNSPECIFIED FileStatus = 0
155+ // The file was added.
156+ FileStatus_FILE_STATUS_ADDED FileStatus = 1
157+ // The file was deleted.
158+ FileStatus_FILE_STATUS_DELETED FileStatus = 2
159+ // The content or the mode of the file changed.
160+ FileStatus_FILE_STATUS_MODIFIED FileStatus = 3
161+ // The file was moved, possibly with changes. Rename detection is done by Git.
162+ FileStatus_FILE_STATUS_RENAMED FileStatus = 4
163+ // The file was copied from another file, possibly with changes.
164+ FileStatus_FILE_STATUS_COPIED FileStatus = 5
165+ // The type of the entry changed, for example a file became a symbolic link.
166+ FileStatus_FILE_STATUS_TYPE_CHANGED FileStatus = 6
167+)
168+
169+// Enum value maps for FileStatus.
170+var (
171+ FileStatus_name = map[int32]string{
172+ 0: "FILE_STATUS_UNSPECIFIED",
173+ 1: "FILE_STATUS_ADDED",
174+ 2: "FILE_STATUS_DELETED",
175+ 3: "FILE_STATUS_MODIFIED",
176+ 4: "FILE_STATUS_RENAMED",
177+ 5: "FILE_STATUS_COPIED",
178+ 6: "FILE_STATUS_TYPE_CHANGED",
179+ }
180+ FileStatus_value = map[string]int32{
181+ "FILE_STATUS_UNSPECIFIED": 0,
182+ "FILE_STATUS_ADDED": 1,
183+ "FILE_STATUS_DELETED": 2,
184+ "FILE_STATUS_MODIFIED": 3,
185+ "FILE_STATUS_RENAMED": 4,
186+ "FILE_STATUS_COPIED": 5,
187+ "FILE_STATUS_TYPE_CHANGED": 6,
188+ }
189+)
190+
191+func (x FileStatus) Enum() *FileStatus {
192+ p := new(FileStatus)
193+ *p = x
194+ return p
195+}
196+
197+func (x FileStatus) String() string {
198+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
199+}
200+
201+func (FileStatus) Descriptor() protoreflect.EnumDescriptor {
202+ return file_ermite_git_proto_enumTypes[2].Descriptor()
203+}
204+
205+func (FileStatus) Type() protoreflect.EnumType {
206+ return &file_ermite_git_proto_enumTypes[2]
207+}
208+
209+func (x FileStatus) Number() protoreflect.EnumNumber {
210+ return protoreflect.EnumNumber(x)
211+}
212+
213+// Deprecated: Use FileStatus.Descriptor instead.
214+func (FileStatus) EnumDescriptor() ([]byte, []int) {
215+ return file_ermite_git_proto_rawDescGZIP(), []int{2}
216+}
217+
218+// LineKind tells how a line of a hunk relates to the two sides of a diff.
219+type LineKind int32
220+
221+const (
222+ // Not set. Never returned.
223+ LineKind_LINE_KIND_UNSPECIFIED LineKind = 0
224+ // The line is present, unchanged, on both sides.
225+ LineKind_LINE_KIND_CONTEXT LineKind = 1
226+ // The line exists only on the new side.
227+ LineKind_LINE_KIND_ADDITION LineKind = 2
228+ // The line exists only on the old side.
229+ LineKind_LINE_KIND_DELETION LineKind = 3
230+)
231+
232+// Enum value maps for LineKind.
233+var (
234+ LineKind_name = map[int32]string{
235+ 0: "LINE_KIND_UNSPECIFIED",
236+ 1: "LINE_KIND_CONTEXT",
237+ 2: "LINE_KIND_ADDITION",
238+ 3: "LINE_KIND_DELETION",
239+ }
240+ LineKind_value = map[string]int32{
241+ "LINE_KIND_UNSPECIFIED": 0,
242+ "LINE_KIND_CONTEXT": 1,
243+ "LINE_KIND_ADDITION": 2,
244+ "LINE_KIND_DELETION": 3,
245+ }
246+)
247+
248+func (x LineKind) Enum() *LineKind {
249+ p := new(LineKind)
250+ *p = x
251+ return p
252+}
253+
254+func (x LineKind) String() string {
255+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
256+}
257+
258+func (LineKind) Descriptor() protoreflect.EnumDescriptor {
259+ return file_ermite_git_proto_enumTypes[3].Descriptor()
260+}
261+
262+func (LineKind) Type() protoreflect.EnumType {
263+ return &file_ermite_git_proto_enumTypes[3]
264+}
265+
266+func (x LineKind) Number() protoreflect.EnumNumber {
267+ return protoreflect.EnumNumber(x)
268+}
269+
270+// Deprecated: Use LineKind.Descriptor instead.
271+func (LineKind) EnumDescriptor() ([]byte, []int) {
272+ return file_ermite_git_proto_rawDescGZIP(), []int{3}
273+}
274+
275+// Ref is a branch, a tag or HEAD.
276+type Ref struct {
277+ state protoimpl.MessageState `protogen:"open.v1"`
278+ // Name is the full ref name, for example "refs/heads/main" or
279+ // "refs/tags/v1.0.0". For HEAD it is "HEAD".
280+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
281+ // ShortName is the name without its "refs/heads/" or "refs/tags/" prefix. For
282+ // HEAD it is the short name of the default branch, or empty if HEAD points
283+ // to a branch that does not exist yet.
284+ ShortName string `protobuf:"bytes,2,opt,name=short_name,json=shortName,proto3" json:"short_name,omitempty"`
285+ // Kind is the kind of the ref.
286+ Kind RefKind `protobuf:"varint,3,opt,name=kind,proto3,enum=ermite.RefKind" json:"kind,omitempty"`
287+ // Id is the id of the object the ref points to. For an annotated tag it is
288+ // the id of the tag object.
289+ Id string `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"`
290+ // CommitId is the id of the commit the ref designates once annotated tags are
291+ // followed. It equals id for branches and lightweight tags. It is empty for
292+ // a tag that points to something other than a commit.
293+ CommitId string `protobuf:"bytes,5,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
294+ unknownFields protoimpl.UnknownFields
295+ sizeCache protoimpl.SizeCache
296+}
297+
298+func (x *Ref) Reset() {
299+ *x = Ref{}
300+ mi := &file_ermite_git_proto_msgTypes[0]
301+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
302+ ms.StoreMessageInfo(mi)
303+}
304+
305+func (x *Ref) String() string {
306+ return protoimpl.X.MessageStringOf(x)
307+}
308+
309+func (*Ref) ProtoMessage() {}
310+
311+func (x *Ref) ProtoReflect() protoreflect.Message {
312+ mi := &file_ermite_git_proto_msgTypes[0]
313+ if x != nil {
314+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
315+ if ms.LoadMessageInfo() == nil {
316+ ms.StoreMessageInfo(mi)
317+ }
318+ return ms
319+ }
320+ return mi.MessageOf(x)
321+}
322+
323+// Deprecated: Use Ref.ProtoReflect.Descriptor instead.
324+func (*Ref) Descriptor() ([]byte, []int) {
325+ return file_ermite_git_proto_rawDescGZIP(), []int{0}
326+}
327+
328+func (x *Ref) GetName() string {
329+ if x != nil {
330+ return x.Name
331+ }
332+ return ""
333+}
334+
335+func (x *Ref) GetShortName() string {
336+ if x != nil {
337+ return x.ShortName
338+ }
339+ return ""
340+}
341+
342+func (x *Ref) GetKind() RefKind {
343+ if x != nil {
344+ return x.Kind
345+ }
346+ return RefKind_REF_KIND_UNSPECIFIED
347+}
348+
349+func (x *Ref) GetId() string {
350+ if x != nil {
351+ return x.Id
352+ }
353+ return ""
354+}
355+
356+func (x *Ref) GetCommitId() string {
357+ if x != nil {
358+ return x.CommitId
359+ }
360+ return ""
361+}
362+
363+// ListRefsRequest selects the refs to list.
364+type ListRefsRequest struct {
365+ state protoimpl.MessageState `protogen:"open.v1"`
366+ // Repo is the repository name.
367+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
368+ // Kinds restricts the result to these kinds. Empty means all kinds.
369+ Kinds []RefKind `protobuf:"varint,2,rep,packed,name=kinds,proto3,enum=ermite.RefKind" json:"kinds,omitempty"`
370+ // PageSize is the maximum number of refs to return. 0 means the server
371+ // default; values above the server maximum are lowered to it.
372+ PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
373+ // PageToken is the next_page_token of a previous response. Empty for the
374+ // first page.
375+ PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
376+ unknownFields protoimpl.UnknownFields
377+ sizeCache protoimpl.SizeCache
378+}
379+
380+func (x *ListRefsRequest) Reset() {
381+ *x = ListRefsRequest{}
382+ mi := &file_ermite_git_proto_msgTypes[1]
383+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
384+ ms.StoreMessageInfo(mi)
385+}
386+
387+func (x *ListRefsRequest) String() string {
388+ return protoimpl.X.MessageStringOf(x)
389+}
390+
391+func (*ListRefsRequest) ProtoMessage() {}
392+
393+func (x *ListRefsRequest) ProtoReflect() protoreflect.Message {
394+ mi := &file_ermite_git_proto_msgTypes[1]
395+ if x != nil {
396+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
397+ if ms.LoadMessageInfo() == nil {
398+ ms.StoreMessageInfo(mi)
399+ }
400+ return ms
401+ }
402+ return mi.MessageOf(x)
403+}
404+
405+// Deprecated: Use ListRefsRequest.ProtoReflect.Descriptor instead.
406+func (*ListRefsRequest) Descriptor() ([]byte, []int) {
407+ return file_ermite_git_proto_rawDescGZIP(), []int{1}
408+}
409+
410+func (x *ListRefsRequest) GetRepo() string {
411+ if x != nil {
412+ return x.Repo
413+ }
414+ return ""
415+}
416+
417+func (x *ListRefsRequest) GetKinds() []RefKind {
418+ if x != nil {
419+ return x.Kinds
420+ }
421+ return nil
422+}
423+
424+func (x *ListRefsRequest) GetPageSize() int32 {
425+ if x != nil {
426+ return x.PageSize
427+ }
428+ return 0
429+}
430+
431+func (x *ListRefsRequest) GetPageToken() string {
432+ if x != nil {
433+ return x.PageToken
434+ }
435+ return ""
436+}
437+
438+// ListRefsResponse is one page of refs.
439+type ListRefsResponse struct {
440+ state protoimpl.MessageState `protogen:"open.v1"`
441+ // Refs are the refs of this page.
442+ Refs []*Ref `protobuf:"bytes,1,rep,name=refs,proto3" json:"refs,omitempty"`
443+ // NextPageToken is passed as page_token to get the next page. Empty when
444+ // there is no next page.
445+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
446+ unknownFields protoimpl.UnknownFields
447+ sizeCache protoimpl.SizeCache
448+}
449+
450+func (x *ListRefsResponse) Reset() {
451+ *x = ListRefsResponse{}
452+ mi := &file_ermite_git_proto_msgTypes[2]
453+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
454+ ms.StoreMessageInfo(mi)
455+}
456+
457+func (x *ListRefsResponse) String() string {
458+ return protoimpl.X.MessageStringOf(x)
459+}
460+
461+func (*ListRefsResponse) ProtoMessage() {}
462+
463+func (x *ListRefsResponse) ProtoReflect() protoreflect.Message {
464+ mi := &file_ermite_git_proto_msgTypes[2]
465+ if x != nil {
466+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
467+ if ms.LoadMessageInfo() == nil {
468+ ms.StoreMessageInfo(mi)
469+ }
470+ return ms
471+ }
472+ return mi.MessageOf(x)
473+}
474+
475+// Deprecated: Use ListRefsResponse.ProtoReflect.Descriptor instead.
476+func (*ListRefsResponse) Descriptor() ([]byte, []int) {
477+ return file_ermite_git_proto_rawDescGZIP(), []int{2}
478+}
479+
480+func (x *ListRefsResponse) GetRefs() []*Ref {
481+ if x != nil {
482+ return x.Refs
483+ }
484+ return nil
485+}
486+
487+func (x *ListRefsResponse) GetNextPageToken() string {
488+ if x != nil {
489+ return x.NextPageToken
490+ }
491+ return ""
492+}
493+
494+// TreeEntry is one entry of a directory.
495+type TreeEntry struct {
496+ state protoimpl.MessageState `protogen:"open.v1"`
497+ // Name is the name of the entry in its directory, without slash.
498+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
499+ // Path is the path of the entry from the repository root, with "/"
500+ // separators and no leading slash.
501+ Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
502+ // Kind is the kind of the entry.
503+ Kind EntryKind `protobuf:"varint,3,opt,name=kind,proto3,enum=ermite.EntryKind" json:"kind,omitempty"`
504+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
505+ Mode uint32 `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"`
506+ // Id is the object id of the blob, tree or submodule commit.
507+ Id string `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
508+ // Size is the size in bytes of a file or symbolic link. It is 0 for
509+ // directories and submodules.
510+ Size int64 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"`
511+ // LastCommit is the latest commit that changed the entry. Set only when the
512+ // request asked for it with include_last_commit.
513+ LastCommit *Commit `protobuf:"bytes,7,opt,name=last_commit,json=lastCommit,proto3" json:"last_commit,omitempty"`
514+ unknownFields protoimpl.UnknownFields
515+ sizeCache protoimpl.SizeCache
516+}
517+
518+func (x *TreeEntry) Reset() {
519+ *x = TreeEntry{}
520+ mi := &file_ermite_git_proto_msgTypes[3]
521+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
522+ ms.StoreMessageInfo(mi)
523+}
524+
525+func (x *TreeEntry) String() string {
526+ return protoimpl.X.MessageStringOf(x)
527+}
528+
529+func (*TreeEntry) ProtoMessage() {}
530+
531+func (x *TreeEntry) ProtoReflect() protoreflect.Message {
532+ mi := &file_ermite_git_proto_msgTypes[3]
533+ if x != nil {
534+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
535+ if ms.LoadMessageInfo() == nil {
536+ ms.StoreMessageInfo(mi)
537+ }
538+ return ms
539+ }
540+ return mi.MessageOf(x)
541+}
542+
543+// Deprecated: Use TreeEntry.ProtoReflect.Descriptor instead.
544+func (*TreeEntry) Descriptor() ([]byte, []int) {
545+ return file_ermite_git_proto_rawDescGZIP(), []int{3}
546+}
547+
548+func (x *TreeEntry) GetName() string {
549+ if x != nil {
550+ return x.Name
551+ }
552+ return ""
553+}
554+
555+func (x *TreeEntry) GetPath() string {
556+ if x != nil {
557+ return x.Path
558+ }
559+ return ""
560+}
561+
562+func (x *TreeEntry) GetKind() EntryKind {
563+ if x != nil {
564+ return x.Kind
565+ }
566+ return EntryKind_ENTRY_KIND_UNSPECIFIED
567+}
568+
569+func (x *TreeEntry) GetMode() uint32 {
570+ if x != nil {
571+ return x.Mode
572+ }
573+ return 0
574+}
575+
576+func (x *TreeEntry) GetId() string {
577+ if x != nil {
578+ return x.Id
579+ }
580+ return ""
581+}
582+
583+func (x *TreeEntry) GetSize() int64 {
584+ if x != nil {
585+ return x.Size
586+ }
587+ return 0
588+}
589+
590+func (x *TreeEntry) GetLastCommit() *Commit {
591+ if x != nil {
592+ return x.LastCommit
593+ }
594+ return nil
595+}
596+
597+// GetTreeRequest selects a directory.
598+type GetTreeRequest struct {
599+ state protoimpl.MessageState `protogen:"open.v1"`
600+ // Repo is the repository name.
601+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
602+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
603+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
604+ // Path is the directory, from the repository root, with "/" separators.
605+ // Empty means the root.
606+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
607+ // IncludeLastCommit asks for the last commit of every entry in last_commit.
608+ // It costs one history walk, so it is off by default and the server may be
609+ // slow on large directories.
610+ IncludeLastCommit bool `protobuf:"varint,4,opt,name=include_last_commit,json=includeLastCommit,proto3" json:"include_last_commit,omitempty"`
611+ unknownFields protoimpl.UnknownFields
612+ sizeCache protoimpl.SizeCache
613+}
614+
615+func (x *GetTreeRequest) Reset() {
616+ *x = GetTreeRequest{}
617+ mi := &file_ermite_git_proto_msgTypes[4]
618+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
619+ ms.StoreMessageInfo(mi)
620+}
621+
622+func (x *GetTreeRequest) String() string {
623+ return protoimpl.X.MessageStringOf(x)
624+}
625+
626+func (*GetTreeRequest) ProtoMessage() {}
627+
628+func (x *GetTreeRequest) ProtoReflect() protoreflect.Message {
629+ mi := &file_ermite_git_proto_msgTypes[4]
630+ if x != nil {
631+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
632+ if ms.LoadMessageInfo() == nil {
633+ ms.StoreMessageInfo(mi)
634+ }
635+ return ms
636+ }
637+ return mi.MessageOf(x)
638+}
639+
640+// Deprecated: Use GetTreeRequest.ProtoReflect.Descriptor instead.
641+func (*GetTreeRequest) Descriptor() ([]byte, []int) {
642+ return file_ermite_git_proto_rawDescGZIP(), []int{4}
643+}
644+
645+func (x *GetTreeRequest) GetRepo() string {
646+ if x != nil {
647+ return x.Repo
648+ }
649+ return ""
650+}
651+
652+func (x *GetTreeRequest) GetRevision() string {
653+ if x != nil {
654+ return x.Revision
655+ }
656+ return ""
657+}
658+
659+func (x *GetTreeRequest) GetPath() string {
660+ if x != nil {
661+ return x.Path
662+ }
663+ return ""
664+}
665+
666+func (x *GetTreeRequest) GetIncludeLastCommit() bool {
667+ if x != nil {
668+ return x.IncludeLastCommit
669+ }
670+ return false
671+}
672+
673+// GetTreeResponse lists a directory.
674+type GetTreeResponse struct {
675+ state protoimpl.MessageState `protogen:"open.v1"`
676+ // CommitId is the id of the commit the revision resolved to.
677+ CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
678+ // TreeId is the object id of the listed directory.
679+ TreeId string `protobuf:"bytes,2,opt,name=tree_id,json=treeId,proto3" json:"tree_id,omitempty"`
680+ // Entries are the entries of the directory: directories first, then the other
681+ // entries, each group ordered by name.
682+ Entries []*TreeEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries,omitempty"`
683+ unknownFields protoimpl.UnknownFields
684+ sizeCache protoimpl.SizeCache
685+}
686+
687+func (x *GetTreeResponse) Reset() {
688+ *x = GetTreeResponse{}
689+ mi := &file_ermite_git_proto_msgTypes[5]
690+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
691+ ms.StoreMessageInfo(mi)
692+}
693+
694+func (x *GetTreeResponse) String() string {
695+ return protoimpl.X.MessageStringOf(x)
696+}
697+
698+func (*GetTreeResponse) ProtoMessage() {}
699+
700+func (x *GetTreeResponse) ProtoReflect() protoreflect.Message {
701+ mi := &file_ermite_git_proto_msgTypes[5]
702+ if x != nil {
703+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
704+ if ms.LoadMessageInfo() == nil {
705+ ms.StoreMessageInfo(mi)
706+ }
707+ return ms
708+ }
709+ return mi.MessageOf(x)
710+}
711+
712+// Deprecated: Use GetTreeResponse.ProtoReflect.Descriptor instead.
713+func (*GetTreeResponse) Descriptor() ([]byte, []int) {
714+ return file_ermite_git_proto_rawDescGZIP(), []int{5}
715+}
716+
717+func (x *GetTreeResponse) GetCommitId() string {
718+ if x != nil {
719+ return x.CommitId
720+ }
721+ return ""
722+}
723+
724+func (x *GetTreeResponse) GetTreeId() string {
725+ if x != nil {
726+ return x.TreeId
727+ }
728+ return ""
729+}
730+
731+func (x *GetTreeResponse) GetEntries() []*TreeEntry {
732+ if x != nil {
733+ return x.Entries
734+ }
735+ return nil
736+}
737+
738+// BlobInfo describes a file.
739+type BlobInfo struct {
740+ state protoimpl.MessageState `protogen:"open.v1"`
741+ // Id is the object id of the blob.
742+ Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
743+ // Path is the path of the file from the repository root.
744+ Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
745+ // Size is the size of the whole content in bytes.
746+ Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
747+ // Binary is true if the content is binary, with Git's rule: a NUL byte in the
748+ // first 8,000 bytes.
749+ Binary bool `protobuf:"varint,4,opt,name=binary,proto3" json:"binary,omitempty"`
750+ // MediaType is the detected media type, for example "text/plain" or
751+ // "image/png", from the file name and the first bytes. It is
752+ // "application/octet-stream" when unknown.
753+ MediaType string `protobuf:"bytes,5,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
754+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
755+ Mode uint32 `protobuf:"varint,6,opt,name=mode,proto3" json:"mode,omitempty"`
756+ unknownFields protoimpl.UnknownFields
757+ sizeCache protoimpl.SizeCache
758+}
759+
760+func (x *BlobInfo) Reset() {
761+ *x = BlobInfo{}
762+ mi := &file_ermite_git_proto_msgTypes[6]
763+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
764+ ms.StoreMessageInfo(mi)
765+}
766+
767+func (x *BlobInfo) String() string {
768+ return protoimpl.X.MessageStringOf(x)
769+}
770+
771+func (*BlobInfo) ProtoMessage() {}
772+
773+func (x *BlobInfo) ProtoReflect() protoreflect.Message {
774+ mi := &file_ermite_git_proto_msgTypes[6]
775+ if x != nil {
776+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
777+ if ms.LoadMessageInfo() == nil {
778+ ms.StoreMessageInfo(mi)
779+ }
780+ return ms
781+ }
782+ return mi.MessageOf(x)
783+}
784+
785+// Deprecated: Use BlobInfo.ProtoReflect.Descriptor instead.
786+func (*BlobInfo) Descriptor() ([]byte, []int) {
787+ return file_ermite_git_proto_rawDescGZIP(), []int{6}
788+}
789+
790+func (x *BlobInfo) GetId() string {
791+ if x != nil {
792+ return x.Id
793+ }
794+ return ""
795+}
796+
797+func (x *BlobInfo) GetPath() string {
798+ if x != nil {
799+ return x.Path
800+ }
801+ return ""
802+}
803+
804+func (x *BlobInfo) GetSize() int64 {
805+ if x != nil {
806+ return x.Size
807+ }
808+ return 0
809+}
810+
811+func (x *BlobInfo) GetBinary() bool {
812+ if x != nil {
813+ return x.Binary
814+ }
815+ return false
816+}
817+
818+func (x *BlobInfo) GetMediaType() string {
819+ if x != nil {
820+ return x.MediaType
821+ }
822+ return ""
823+}
824+
825+func (x *BlobInfo) GetMode() uint32 {
826+ if x != nil {
827+ return x.Mode
828+ }
829+ return 0
830+}
831+
832+// GetBlobRequest selects a file.
833+type GetBlobRequest struct {
834+ state protoimpl.MessageState `protogen:"open.v1"`
835+ // Repo is the repository name.
836+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
837+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
838+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
839+ // Path is the file, from the repository root. It is required.
840+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
841+ unknownFields protoimpl.UnknownFields
842+ sizeCache protoimpl.SizeCache
843+}
844+
845+func (x *GetBlobRequest) Reset() {
846+ *x = GetBlobRequest{}
847+ mi := &file_ermite_git_proto_msgTypes[7]
848+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
849+ ms.StoreMessageInfo(mi)
850+}
851+
852+func (x *GetBlobRequest) String() string {
853+ return protoimpl.X.MessageStringOf(x)
854+}
855+
856+func (*GetBlobRequest) ProtoMessage() {}
857+
858+func (x *GetBlobRequest) ProtoReflect() protoreflect.Message {
859+ mi := &file_ermite_git_proto_msgTypes[7]
860+ if x != nil {
861+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
862+ if ms.LoadMessageInfo() == nil {
863+ ms.StoreMessageInfo(mi)
864+ }
865+ return ms
866+ }
867+ return mi.MessageOf(x)
868+}
869+
870+// Deprecated: Use GetBlobRequest.ProtoReflect.Descriptor instead.
871+func (*GetBlobRequest) Descriptor() ([]byte, []int) {
872+ return file_ermite_git_proto_rawDescGZIP(), []int{7}
873+}
874+
875+func (x *GetBlobRequest) GetRepo() string {
876+ if x != nil {
877+ return x.Repo
878+ }
879+ return ""
880+}
881+
882+func (x *GetBlobRequest) GetRevision() string {
883+ if x != nil {
884+ return x.Revision
885+ }
886+ return ""
887+}
888+
889+func (x *GetBlobRequest) GetPath() string {
890+ if x != nil {
891+ return x.Path
892+ }
893+ return ""
894+}
895+
896+// GetBlobResponse is one message of the content stream.
897+type GetBlobResponse struct {
898+ state protoimpl.MessageState `protogen:"open.v1"`
899+ // Info describes the file. Set in the first message of the stream only.
900+ Info *BlobInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
901+ // Chunk is the next part of the content, at most 64 KiB, in order. The first
902+ // message may have an empty chunk. The chunks of a stream add up to
903+ // info.size bytes.
904+ Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3" json:"chunk,omitempty"`
905+ unknownFields protoimpl.UnknownFields
906+ sizeCache protoimpl.SizeCache
907+}
908+
909+func (x *GetBlobResponse) Reset() {
910+ *x = GetBlobResponse{}
911+ mi := &file_ermite_git_proto_msgTypes[8]
912+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
913+ ms.StoreMessageInfo(mi)
914+}
915+
916+func (x *GetBlobResponse) String() string {
917+ return protoimpl.X.MessageStringOf(x)
918+}
919+
920+func (*GetBlobResponse) ProtoMessage() {}
921+
922+func (x *GetBlobResponse) ProtoReflect() protoreflect.Message {
923+ mi := &file_ermite_git_proto_msgTypes[8]
924+ if x != nil {
925+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
926+ if ms.LoadMessageInfo() == nil {
927+ ms.StoreMessageInfo(mi)
928+ }
929+ return ms
930+ }
931+ return mi.MessageOf(x)
932+}
933+
934+// Deprecated: Use GetBlobResponse.ProtoReflect.Descriptor instead.
935+func (*GetBlobResponse) Descriptor() ([]byte, []int) {
936+ return file_ermite_git_proto_rawDescGZIP(), []int{8}
937+}
938+
939+func (x *GetBlobResponse) GetInfo() *BlobInfo {
940+ if x != nil {
941+ return x.Info
942+ }
943+ return nil
944+}
945+
946+func (x *GetBlobResponse) GetChunk() []byte {
947+ if x != nil {
948+ return x.Chunk
949+ }
950+ return nil
951+}
952+
953+// ListCommitsRequest selects a page of history.
954+type ListCommitsRequest struct {
955+ state protoimpl.MessageState `protogen:"open.v1"`
956+ // Repo is the repository name.
957+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
958+ // Revision is where the history starts: a branch, a tag or a commit id.
959+ // Empty means HEAD.
960+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
961+ // Path restricts the result to the commits that changed this file or
962+ // directory. Empty means the whole history.
963+ Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
964+ // PageSize is the maximum number of commits to return. 0 means the server
965+ // default; values above 100 are lowered to 100.
966+ PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
967+ // PageToken is the next_page_token of a previous response, to continue the
968+ // same listing. Empty for the first page. Other fields must be unchanged.
969+ PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
970+ unknownFields protoimpl.UnknownFields
971+ sizeCache protoimpl.SizeCache
972+}
973+
974+func (x *ListCommitsRequest) Reset() {
975+ *x = ListCommitsRequest{}
976+ mi := &file_ermite_git_proto_msgTypes[9]
977+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
978+ ms.StoreMessageInfo(mi)
979+}
980+
981+func (x *ListCommitsRequest) String() string {
982+ return protoimpl.X.MessageStringOf(x)
983+}
984+
985+func (*ListCommitsRequest) ProtoMessage() {}
986+
987+func (x *ListCommitsRequest) ProtoReflect() protoreflect.Message {
988+ mi := &file_ermite_git_proto_msgTypes[9]
989+ if x != nil {
990+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
991+ if ms.LoadMessageInfo() == nil {
992+ ms.StoreMessageInfo(mi)
993+ }
994+ return ms
995+ }
996+ return mi.MessageOf(x)
997+}
998+
999+// Deprecated: Use ListCommitsRequest.ProtoReflect.Descriptor instead.
1000+func (*ListCommitsRequest) Descriptor() ([]byte, []int) {
1001+ return file_ermite_git_proto_rawDescGZIP(), []int{9}
1002+}
1003+
1004+func (x *ListCommitsRequest) GetRepo() string {
1005+ if x != nil {
1006+ return x.Repo
1007+ }
1008+ return ""
1009+}
1010+
1011+func (x *ListCommitsRequest) GetRevision() string {
1012+ if x != nil {
1013+ return x.Revision
1014+ }
1015+ return ""
1016+}
1017+
1018+func (x *ListCommitsRequest) GetPath() string {
1019+ if x != nil {
1020+ return x.Path
1021+ }
1022+ return ""
1023+}
1024+
1025+func (x *ListCommitsRequest) GetPageSize() int32 {
1026+ if x != nil {
1027+ return x.PageSize
1028+ }
1029+ return 0
1030+}
1031+
1032+func (x *ListCommitsRequest) GetPageToken() string {
1033+ if x != nil {
1034+ return x.PageToken
1035+ }
1036+ return ""
1037+}
1038+
1039+// ListCommitsResponse is one page of commits.
1040+type ListCommitsResponse struct {
1041+ state protoimpl.MessageState `protogen:"open.v1"`
1042+ // Commits are the commits of this page, newest first.
1043+ Commits []*Commit `protobuf:"bytes,1,rep,name=commits,proto3" json:"commits,omitempty"`
1044+ // NextPageToken is passed as page_token to get the next page. Empty when
1045+ // there is no next page.
1046+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
1047+ unknownFields protoimpl.UnknownFields
1048+ sizeCache protoimpl.SizeCache
1049+}
1050+
1051+func (x *ListCommitsResponse) Reset() {
1052+ *x = ListCommitsResponse{}
1053+ mi := &file_ermite_git_proto_msgTypes[10]
1054+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1055+ ms.StoreMessageInfo(mi)
1056+}
1057+
1058+func (x *ListCommitsResponse) String() string {
1059+ return protoimpl.X.MessageStringOf(x)
1060+}
1061+
1062+func (*ListCommitsResponse) ProtoMessage() {}
1063+
1064+func (x *ListCommitsResponse) ProtoReflect() protoreflect.Message {
1065+ mi := &file_ermite_git_proto_msgTypes[10]
1066+ if x != nil {
1067+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1068+ if ms.LoadMessageInfo() == nil {
1069+ ms.StoreMessageInfo(mi)
1070+ }
1071+ return ms
1072+ }
1073+ return mi.MessageOf(x)
1074+}
1075+
1076+// Deprecated: Use ListCommitsResponse.ProtoReflect.Descriptor instead.
1077+func (*ListCommitsResponse) Descriptor() ([]byte, []int) {
1078+ return file_ermite_git_proto_rawDescGZIP(), []int{10}
1079+}
1080+
1081+func (x *ListCommitsResponse) GetCommits() []*Commit {
1082+ if x != nil {
1083+ return x.Commits
1084+ }
1085+ return nil
1086+}
1087+
1088+func (x *ListCommitsResponse) GetNextPageToken() string {
1089+ if x != nil {
1090+ return x.NextPageToken
1091+ }
1092+ return ""
1093+}
1094+
1095+// GetCommitRequest selects a commit.
1096+type GetCommitRequest struct {
1097+ state protoimpl.MessageState `protogen:"open.v1"`
1098+ // Repo is the repository name.
1099+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
1100+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
1101+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
1102+ unknownFields protoimpl.UnknownFields
1103+ sizeCache protoimpl.SizeCache
1104+}
1105+
1106+func (x *GetCommitRequest) Reset() {
1107+ *x = GetCommitRequest{}
1108+ mi := &file_ermite_git_proto_msgTypes[11]
1109+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1110+ ms.StoreMessageInfo(mi)
1111+}
1112+
1113+func (x *GetCommitRequest) String() string {
1114+ return protoimpl.X.MessageStringOf(x)
1115+}
1116+
1117+func (*GetCommitRequest) ProtoMessage() {}
1118+
1119+func (x *GetCommitRequest) ProtoReflect() protoreflect.Message {
1120+ mi := &file_ermite_git_proto_msgTypes[11]
1121+ if x != nil {
1122+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1123+ if ms.LoadMessageInfo() == nil {
1124+ ms.StoreMessageInfo(mi)
1125+ }
1126+ return ms
1127+ }
1128+ return mi.MessageOf(x)
1129+}
1130+
1131+// Deprecated: Use GetCommitRequest.ProtoReflect.Descriptor instead.
1132+func (*GetCommitRequest) Descriptor() ([]byte, []int) {
1133+ return file_ermite_git_proto_rawDescGZIP(), []int{11}
1134+}
1135+
1136+func (x *GetCommitRequest) GetRepo() string {
1137+ if x != nil {
1138+ return x.Repo
1139+ }
1140+ return ""
1141+}
1142+
1143+func (x *GetCommitRequest) GetRevision() string {
1144+ if x != nil {
1145+ return x.Revision
1146+ }
1147+ return ""
1148+}
1149+
1150+// GetCommitResponse holds a commit, its statistics and its diff.
1151+type GetCommitResponse struct {
1152+ state protoimpl.MessageState `protogen:"open.v1"`
1153+ // Commit is the commit metadata.
1154+ Commit *Commit `protobuf:"bytes,1,opt,name=commit,proto3" json:"commit,omitempty"`
1155+ // Stats are the totals over all the changed files, including files that the
1156+ // diff omits or truncates.
1157+ Stats *DiffStats `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
1158+ // Diff is the structured diff against the first parent, or against the empty
1159+ // tree for a root commit. For a merge commit this is the change relative to
1160+ // the first parent.
1161+ Diff *Diff `protobuf:"bytes,3,opt,name=diff,proto3" json:"diff,omitempty"`
1162+ unknownFields protoimpl.UnknownFields
1163+ sizeCache protoimpl.SizeCache
1164+}
1165+
1166+func (x *GetCommitResponse) Reset() {
1167+ *x = GetCommitResponse{}
1168+ mi := &file_ermite_git_proto_msgTypes[12]
1169+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1170+ ms.StoreMessageInfo(mi)
1171+}
1172+
1173+func (x *GetCommitResponse) String() string {
1174+ return protoimpl.X.MessageStringOf(x)
1175+}
1176+
1177+func (*GetCommitResponse) ProtoMessage() {}
1178+
1179+func (x *GetCommitResponse) ProtoReflect() protoreflect.Message {
1180+ mi := &file_ermite_git_proto_msgTypes[12]
1181+ if x != nil {
1182+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1183+ if ms.LoadMessageInfo() == nil {
1184+ ms.StoreMessageInfo(mi)
1185+ }
1186+ return ms
1187+ }
1188+ return mi.MessageOf(x)
1189+}
1190+
1191+// Deprecated: Use GetCommitResponse.ProtoReflect.Descriptor instead.
1192+func (*GetCommitResponse) Descriptor() ([]byte, []int) {
1193+ return file_ermite_git_proto_rawDescGZIP(), []int{12}
1194+}
1195+
1196+func (x *GetCommitResponse) GetCommit() *Commit {
1197+ if x != nil {
1198+ return x.Commit
1199+ }
1200+ return nil
1201+}
1202+
1203+func (x *GetCommitResponse) GetStats() *DiffStats {
1204+ if x != nil {
1205+ return x.Stats
1206+ }
1207+ return nil
1208+}
1209+
1210+func (x *GetCommitResponse) GetDiff() *Diff {
1211+ if x != nil {
1212+ return x.Diff
1213+ }
1214+ return nil
1215+}
1216+
1217+// DiffStats are the totals of a diff.
1218+type DiffStats struct {
1219+ state protoimpl.MessageState `protogen:"open.v1"`
1220+ // FilesChanged is the number of changed files.
1221+ FilesChanged int32 `protobuf:"varint,1,opt,name=files_changed,json=filesChanged,proto3" json:"files_changed,omitempty"`
1222+ // Additions is the number of added lines. Binary files count for 0.
1223+ Additions int32 `protobuf:"varint,2,opt,name=additions,proto3" json:"additions,omitempty"`
1224+ // Deletions is the number of deleted lines. Binary files count for 0.
1225+ Deletions int32 `protobuf:"varint,3,opt,name=deletions,proto3" json:"deletions,omitempty"`
1226+ unknownFields protoimpl.UnknownFields
1227+ sizeCache protoimpl.SizeCache
1228+}
1229+
1230+func (x *DiffStats) Reset() {
1231+ *x = DiffStats{}
1232+ mi := &file_ermite_git_proto_msgTypes[13]
1233+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1234+ ms.StoreMessageInfo(mi)
1235+}
1236+
1237+func (x *DiffStats) String() string {
1238+ return protoimpl.X.MessageStringOf(x)
1239+}
1240+
1241+func (*DiffStats) ProtoMessage() {}
1242+
1243+func (x *DiffStats) ProtoReflect() protoreflect.Message {
1244+ mi := &file_ermite_git_proto_msgTypes[13]
1245+ if x != nil {
1246+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1247+ if ms.LoadMessageInfo() == nil {
1248+ ms.StoreMessageInfo(mi)
1249+ }
1250+ return ms
1251+ }
1252+ return mi.MessageOf(x)
1253+}
1254+
1255+// Deprecated: Use DiffStats.ProtoReflect.Descriptor instead.
1256+func (*DiffStats) Descriptor() ([]byte, []int) {
1257+ return file_ermite_git_proto_rawDescGZIP(), []int{13}
1258+}
1259+
1260+func (x *DiffStats) GetFilesChanged() int32 {
1261+ if x != nil {
1262+ return x.FilesChanged
1263+ }
1264+ return 0
1265+}
1266+
1267+func (x *DiffStats) GetAdditions() int32 {
1268+ if x != nil {
1269+ return x.Additions
1270+ }
1271+ return 0
1272+}
1273+
1274+func (x *DiffStats) GetDeletions() int32 {
1275+ if x != nil {
1276+ return x.Deletions
1277+ }
1278+ return 0
1279+}
1280+
1281+// Diff is the structured difference introduced by a commit.
1282+//
1283+// The server limits its size: at most 300 files, at most 2,000 lines in one
1284+// file and at most 20,000 lines in total (hunk lines, context included). These
1285+// numbers are server behaviour and may change; clients must rely on the
1286+// truncated flags, not on the numbers.
1287+type Diff struct {
1288+ state protoimpl.MessageState `protogen:"open.v1"`
1289+ // Files are the changed files, ordered by path. Files past the file limit are
1290+ // omitted.
1291+ Files []*FileDiff `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
1292+ // Truncated is true when the diff is incomplete: files were omitted, or at
1293+ // least one listed file has truncated set. DiffStats still count everything.
1294+ Truncated bool `protobuf:"varint,2,opt,name=truncated,proto3" json:"truncated,omitempty"`
1295+ unknownFields protoimpl.UnknownFields
1296+ sizeCache protoimpl.SizeCache
1297+}
1298+
1299+func (x *Diff) Reset() {
1300+ *x = Diff{}
1301+ mi := &file_ermite_git_proto_msgTypes[14]
1302+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1303+ ms.StoreMessageInfo(mi)
1304+}
1305+
1306+func (x *Diff) String() string {
1307+ return protoimpl.X.MessageStringOf(x)
1308+}
1309+
1310+func (*Diff) ProtoMessage() {}
1311+
1312+func (x *Diff) ProtoReflect() protoreflect.Message {
1313+ mi := &file_ermite_git_proto_msgTypes[14]
1314+ if x != nil {
1315+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1316+ if ms.LoadMessageInfo() == nil {
1317+ ms.StoreMessageInfo(mi)
1318+ }
1319+ return ms
1320+ }
1321+ return mi.MessageOf(x)
1322+}
1323+
1324+// Deprecated: Use Diff.ProtoReflect.Descriptor instead.
1325+func (*Diff) Descriptor() ([]byte, []int) {
1326+ return file_ermite_git_proto_rawDescGZIP(), []int{14}
1327+}
1328+
1329+func (x *Diff) GetFiles() []*FileDiff {
1330+ if x != nil {
1331+ return x.Files
1332+ }
1333+ return nil
1334+}
1335+
1336+func (x *Diff) GetTruncated() bool {
1337+ if x != nil {
1338+ return x.Truncated
1339+ }
1340+ return false
1341+}
1342+
1343+// FileDiff is the change of one file.
1344+type FileDiff struct {
1345+ state protoimpl.MessageState `protogen:"open.v1"`
1346+ // OldPath is the path before the commit. Empty for an added file.
1347+ OldPath string `protobuf:"bytes,1,opt,name=old_path,json=oldPath,proto3" json:"old_path,omitempty"`
1348+ // NewPath is the path after the commit. Empty for a deleted file.
1349+ NewPath string `protobuf:"bytes,2,opt,name=new_path,json=newPath,proto3" json:"new_path,omitempty"`
1350+ // Status tells what happened to the file.
1351+ Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=ermite.FileStatus" json:"status,omitempty"`
1352+ // OldMode is the Git file mode before the commit, or 0 for an added file.
1353+ OldMode uint32 `protobuf:"varint,4,opt,name=old_mode,json=oldMode,proto3" json:"old_mode,omitempty"`
1354+ // NewMode is the Git file mode after the commit, or 0 for a deleted file.
1355+ NewMode uint32 `protobuf:"varint,5,opt,name=new_mode,json=newMode,proto3" json:"new_mode,omitempty"`
1356+ // OldId is the blob id before the commit. Empty for an added file.
1357+ OldId string `protobuf:"bytes,6,opt,name=old_id,json=oldId,proto3" json:"old_id,omitempty"`
1358+ // NewId is the blob id after the commit. Empty for a deleted file.
1359+ NewId string `protobuf:"bytes,7,opt,name=new_id,json=newId,proto3" json:"new_id,omitempty"`
1360+ // Binary is true if Git treats the file as binary (numstat reports "-"). A
1361+ // binary file has no hunks and additions and deletions are 0.
1362+ Binary bool `protobuf:"varint,8,opt,name=binary,proto3" json:"binary,omitempty"`
1363+ // Additions is the number of added lines.
1364+ Additions int32 `protobuf:"varint,9,opt,name=additions,proto3" json:"additions,omitempty"`
1365+ // Deletions is the number of deleted lines.
1366+ Deletions int32 `protobuf:"varint,10,opt,name=deletions,proto3" json:"deletions,omitempty"`
1367+ // Similarity is the percentage (0-100) of unchanged content for a renamed or
1368+ // copied file, and 0 otherwise.
1369+ Similarity int32 `protobuf:"varint,11,opt,name=similarity,proto3" json:"similarity,omitempty"`
1370+ // Truncated is true when the file exceeded a diff limit: hunks is then empty
1371+ // although the file changed. Additions and deletions remain accurate.
1372+ Truncated bool `protobuf:"varint,12,opt,name=truncated,proto3" json:"truncated,omitempty"`
1373+ // Hunks are the changed regions, in file order. Empty for a binary file, a
1374+ // truncated file, a pure rename and a mode-only change.
1375+ Hunks []*Hunk `protobuf:"bytes,13,rep,name=hunks,proto3" json:"hunks,omitempty"`
1376+ unknownFields protoimpl.UnknownFields
1377+ sizeCache protoimpl.SizeCache
1378+}
1379+
1380+func (x *FileDiff) Reset() {
1381+ *x = FileDiff{}
1382+ mi := &file_ermite_git_proto_msgTypes[15]
1383+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1384+ ms.StoreMessageInfo(mi)
1385+}
1386+
1387+func (x *FileDiff) String() string {
1388+ return protoimpl.X.MessageStringOf(x)
1389+}
1390+
1391+func (*FileDiff) ProtoMessage() {}
1392+
1393+func (x *FileDiff) ProtoReflect() protoreflect.Message {
1394+ mi := &file_ermite_git_proto_msgTypes[15]
1395+ if x != nil {
1396+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1397+ if ms.LoadMessageInfo() == nil {
1398+ ms.StoreMessageInfo(mi)
1399+ }
1400+ return ms
1401+ }
1402+ return mi.MessageOf(x)
1403+}
1404+
1405+// Deprecated: Use FileDiff.ProtoReflect.Descriptor instead.
1406+func (*FileDiff) Descriptor() ([]byte, []int) {
1407+ return file_ermite_git_proto_rawDescGZIP(), []int{15}
1408+}
1409+
1410+func (x *FileDiff) GetOldPath() string {
1411+ if x != nil {
1412+ return x.OldPath
1413+ }
1414+ return ""
1415+}
1416+
1417+func (x *FileDiff) GetNewPath() string {
1418+ if x != nil {
1419+ return x.NewPath
1420+ }
1421+ return ""
1422+}
1423+
1424+func (x *FileDiff) GetStatus() FileStatus {
1425+ if x != nil {
1426+ return x.Status
1427+ }
1428+ return FileStatus_FILE_STATUS_UNSPECIFIED
1429+}
1430+
1431+func (x *FileDiff) GetOldMode() uint32 {
1432+ if x != nil {
1433+ return x.OldMode
1434+ }
1435+ return 0
1436+}
1437+
1438+func (x *FileDiff) GetNewMode() uint32 {
1439+ if x != nil {
1440+ return x.NewMode
1441+ }
1442+ return 0
1443+}
1444+
1445+func (x *FileDiff) GetOldId() string {
1446+ if x != nil {
1447+ return x.OldId
1448+ }
1449+ return ""
1450+}
1451+
1452+func (x *FileDiff) GetNewId() string {
1453+ if x != nil {
1454+ return x.NewId
1455+ }
1456+ return ""
1457+}
1458+
1459+func (x *FileDiff) GetBinary() bool {
1460+ if x != nil {
1461+ return x.Binary
1462+ }
1463+ return false
1464+}
1465+
1466+func (x *FileDiff) GetAdditions() int32 {
1467+ if x != nil {
1468+ return x.Additions
1469+ }
1470+ return 0
1471+}
1472+
1473+func (x *FileDiff) GetDeletions() int32 {
1474+ if x != nil {
1475+ return x.Deletions
1476+ }
1477+ return 0
1478+}
1479+
1480+func (x *FileDiff) GetSimilarity() int32 {
1481+ if x != nil {
1482+ return x.Similarity
1483+ }
1484+ return 0
1485+}
1486+
1487+func (x *FileDiff) GetTruncated() bool {
1488+ if x != nil {
1489+ return x.Truncated
1490+ }
1491+ return false
1492+}
1493+
1494+func (x *FileDiff) GetHunks() []*Hunk {
1495+ if x != nil {
1496+ return x.Hunks
1497+ }
1498+ return nil
1499+}
1500+
1501+// Hunk is a contiguous changed region with its context.
1502+type Hunk struct {
1503+ state protoimpl.MessageState `protogen:"open.v1"`
1504+ // OldStart is the 1-based first line of the region in the old file. 0 when
1505+ // old_lines is 0 and the file was added.
1506+ OldStart int32 `protobuf:"varint,1,opt,name=old_start,json=oldStart,proto3" json:"old_start,omitempty"`
1507+ // OldLines is the number of old-side lines in the hunk.
1508+ OldLines int32 `protobuf:"varint,2,opt,name=old_lines,json=oldLines,proto3" json:"old_lines,omitempty"`
1509+ // NewStart is the 1-based first line of the region in the new file. 0 when
1510+ // new_lines is 0 and the file was deleted.
1511+ NewStart int32 `protobuf:"varint,3,opt,name=new_start,json=newStart,proto3" json:"new_start,omitempty"`
1512+ // NewLines is the number of new-side lines in the hunk.
1513+ NewLines int32 `protobuf:"varint,4,opt,name=new_lines,json=newLines,proto3" json:"new_lines,omitempty"`
1514+ // Header is the text after the second "@@" of the hunk header, usually the
1515+ // enclosing function. It may be empty.
1516+ Header string `protobuf:"bytes,5,opt,name=header,proto3" json:"header,omitempty"`
1517+ // Lines are the lines of the hunk, in order.
1518+ Lines []*Line `protobuf:"bytes,6,rep,name=lines,proto3" json:"lines,omitempty"`
1519+ unknownFields protoimpl.UnknownFields
1520+ sizeCache protoimpl.SizeCache
1521+}
1522+
1523+func (x *Hunk) Reset() {
1524+ *x = Hunk{}
1525+ mi := &file_ermite_git_proto_msgTypes[16]
1526+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1527+ ms.StoreMessageInfo(mi)
1528+}
1529+
1530+func (x *Hunk) String() string {
1531+ return protoimpl.X.MessageStringOf(x)
1532+}
1533+
1534+func (*Hunk) ProtoMessage() {}
1535+
1536+func (x *Hunk) ProtoReflect() protoreflect.Message {
1537+ mi := &file_ermite_git_proto_msgTypes[16]
1538+ if x != nil {
1539+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1540+ if ms.LoadMessageInfo() == nil {
1541+ ms.StoreMessageInfo(mi)
1542+ }
1543+ return ms
1544+ }
1545+ return mi.MessageOf(x)
1546+}
1547+
1548+// Deprecated: Use Hunk.ProtoReflect.Descriptor instead.
1549+func (*Hunk) Descriptor() ([]byte, []int) {
1550+ return file_ermite_git_proto_rawDescGZIP(), []int{16}
1551+}
1552+
1553+func (x *Hunk) GetOldStart() int32 {
1554+ if x != nil {
1555+ return x.OldStart
1556+ }
1557+ return 0
1558+}
1559+
1560+func (x *Hunk) GetOldLines() int32 {
1561+ if x != nil {
1562+ return x.OldLines
1563+ }
1564+ return 0
1565+}
1566+
1567+func (x *Hunk) GetNewStart() int32 {
1568+ if x != nil {
1569+ return x.NewStart
1570+ }
1571+ return 0
1572+}
1573+
1574+func (x *Hunk) GetNewLines() int32 {
1575+ if x != nil {
1576+ return x.NewLines
1577+ }
1578+ return 0
1579+}
1580+
1581+func (x *Hunk) GetHeader() string {
1582+ if x != nil {
1583+ return x.Header
1584+ }
1585+ return ""
1586+}
1587+
1588+func (x *Hunk) GetLines() []*Line {
1589+ if x != nil {
1590+ return x.Lines
1591+ }
1592+ return nil
1593+}
1594+
1595+// Line is one line of a hunk.
1596+type Line struct {
1597+ state protoimpl.MessageState `protogen:"open.v1"`
1598+ // Kind tells which side the line belongs to.
1599+ Kind LineKind `protobuf:"varint,1,opt,name=kind,proto3,enum=ermite.LineKind" json:"kind,omitempty"`
1600+ // OldNumber is the 1-based line number on the old side. 0 for an addition.
1601+ OldNumber int32 `protobuf:"varint,2,opt,name=old_number,json=oldNumber,proto3" json:"old_number,omitempty"`
1602+ // NewNumber is the 1-based line number on the new side. 0 for a deletion.
1603+ NewNumber int32 `protobuf:"varint,3,opt,name=new_number,json=newNumber,proto3" json:"new_number,omitempty"`
1604+ // Text is the content without the line terminator. Bytes that are not valid
1605+ // UTF-8 are replaced by the replacement character.
1606+ Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
1607+ // NoNewlineAtEof is true when this is the last line of its side and the file
1608+ // does not end with a line break there.
1609+ NoNewlineAtEof bool `protobuf:"varint,5,opt,name=no_newline_at_eof,json=noNewlineAtEof,proto3" json:"no_newline_at_eof,omitempty"`
1610+ unknownFields protoimpl.UnknownFields
1611+ sizeCache protoimpl.SizeCache
1612+}
1613+
1614+func (x *Line) Reset() {
1615+ *x = Line{}
1616+ mi := &file_ermite_git_proto_msgTypes[17]
1617+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1618+ ms.StoreMessageInfo(mi)
1619+}
1620+
1621+func (x *Line) String() string {
1622+ return protoimpl.X.MessageStringOf(x)
1623+}
1624+
1625+func (*Line) ProtoMessage() {}
1626+
1627+func (x *Line) ProtoReflect() protoreflect.Message {
1628+ mi := &file_ermite_git_proto_msgTypes[17]
1629+ if x != nil {
1630+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1631+ if ms.LoadMessageInfo() == nil {
1632+ ms.StoreMessageInfo(mi)
1633+ }
1634+ return ms
1635+ }
1636+ return mi.MessageOf(x)
1637+}
1638+
1639+// Deprecated: Use Line.ProtoReflect.Descriptor instead.
1640+func (*Line) Descriptor() ([]byte, []int) {
1641+ return file_ermite_git_proto_rawDescGZIP(), []int{17}
1642+}
1643+
1644+func (x *Line) GetKind() LineKind {
1645+ if x != nil {
1646+ return x.Kind
1647+ }
1648+ return LineKind_LINE_KIND_UNSPECIFIED
1649+}
1650+
1651+func (x *Line) GetOldNumber() int32 {
1652+ if x != nil {
1653+ return x.OldNumber
1654+ }
1655+ return 0
1656+}
1657+
1658+func (x *Line) GetNewNumber() int32 {
1659+ if x != nil {
1660+ return x.NewNumber
1661+ }
1662+ return 0
1663+}
1664+
1665+func (x *Line) GetText() string {
1666+ if x != nil {
1667+ return x.Text
1668+ }
1669+ return ""
1670+}
1671+
1672+func (x *Line) GetNoNewlineAtEof() bool {
1673+ if x != nil {
1674+ return x.NoNewlineAtEof
1675+ }
1676+ return false
1677+}
1678+
1679+// ResolveRevisionRequest names a revision.
1680+type ResolveRevisionRequest struct {
1681+ state protoimpl.MessageState `protogen:"open.v1"`
1682+ // Repo is the repository name.
1683+ Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"repo,omitempty"`
1684+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
1685+ Revision string `protobuf:"bytes,2,opt,name=revision,proto3" json:"revision,omitempty"`
1686+ unknownFields protoimpl.UnknownFields
1687+ sizeCache protoimpl.SizeCache
1688+}
1689+
1690+func (x *ResolveRevisionRequest) Reset() {
1691+ *x = ResolveRevisionRequest{}
1692+ mi := &file_ermite_git_proto_msgTypes[18]
1693+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1694+ ms.StoreMessageInfo(mi)
1695+}
1696+
1697+func (x *ResolveRevisionRequest) String() string {
1698+ return protoimpl.X.MessageStringOf(x)
1699+}
1700+
1701+func (*ResolveRevisionRequest) ProtoMessage() {}
1702+
1703+func (x *ResolveRevisionRequest) ProtoReflect() protoreflect.Message {
1704+ mi := &file_ermite_git_proto_msgTypes[18]
1705+ if x != nil {
1706+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1707+ if ms.LoadMessageInfo() == nil {
1708+ ms.StoreMessageInfo(mi)
1709+ }
1710+ return ms
1711+ }
1712+ return mi.MessageOf(x)
1713+}
1714+
1715+// Deprecated: Use ResolveRevisionRequest.ProtoReflect.Descriptor instead.
1716+func (*ResolveRevisionRequest) Descriptor() ([]byte, []int) {
1717+ return file_ermite_git_proto_rawDescGZIP(), []int{18}
1718+}
1719+
1720+func (x *ResolveRevisionRequest) GetRepo() string {
1721+ if x != nil {
1722+ return x.Repo
1723+ }
1724+ return ""
1725+}
1726+
1727+func (x *ResolveRevisionRequest) GetRevision() string {
1728+ if x != nil {
1729+ return x.Revision
1730+ }
1731+ return ""
1732+}
1733+
1734+// ResolveRevisionResponse holds the resolved commit.
1735+type ResolveRevisionResponse struct {
1736+ state protoimpl.MessageState `protogen:"open.v1"`
1737+ // CommitId is the full id of the commit the revision designates, after
1738+ // following annotated tags.
1739+ CommitId string `protobuf:"bytes,1,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
1740+ // Ref is the full name of the ref the revision matched, for example
1741+ // "refs/heads/main". Empty when the revision was a commit id or for HEAD
1742+ // when it is resolved by default.
1743+ Ref string `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
1744+ unknownFields protoimpl.UnknownFields
1745+ sizeCache protoimpl.SizeCache
1746+}
1747+
1748+func (x *ResolveRevisionResponse) Reset() {
1749+ *x = ResolveRevisionResponse{}
1750+ mi := &file_ermite_git_proto_msgTypes[19]
1751+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1752+ ms.StoreMessageInfo(mi)
1753+}
1754+
1755+func (x *ResolveRevisionResponse) String() string {
1756+ return protoimpl.X.MessageStringOf(x)
1757+}
1758+
1759+func (*ResolveRevisionResponse) ProtoMessage() {}
1760+
1761+func (x *ResolveRevisionResponse) ProtoReflect() protoreflect.Message {
1762+ mi := &file_ermite_git_proto_msgTypes[19]
1763+ if x != nil {
1764+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1765+ if ms.LoadMessageInfo() == nil {
1766+ ms.StoreMessageInfo(mi)
1767+ }
1768+ return ms
1769+ }
1770+ return mi.MessageOf(x)
1771+}
1772+
1773+// Deprecated: Use ResolveRevisionResponse.ProtoReflect.Descriptor instead.
1774+func (*ResolveRevisionResponse) Descriptor() ([]byte, []int) {
1775+ return file_ermite_git_proto_rawDescGZIP(), []int{19}
1776+}
1777+
1778+func (x *ResolveRevisionResponse) GetCommitId() string {
1779+ if x != nil {
1780+ return x.CommitId
1781+ }
1782+ return ""
1783+}
1784+
1785+func (x *ResolveRevisionResponse) GetRef() string {
1786+ if x != nil {
1787+ return x.Ref
1788+ }
1789+ return ""
1790+}
1791+
1792+var File_ermite_git_proto protoreflect.FileDescriptor
1793+
1794+const file_ermite_git_proto_rawDesc = "" +
1795+ "\n" +
1796+ "\x10ermite/git.proto\x12\x06ermite\x1a\x12ermite/types.proto\"\x8a\x01\n" +
1797+ "\x03Ref\x12\x12\n" +
1798+ "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" +
1799+ "\n" +
1800+ "short_name\x18\x02 \x01(\tR\tshortName\x12#\n" +
1801+ "\x04kind\x18\x03 \x01(\x0e2\x0f.ermite.RefKindR\x04kind\x12\x0e\n" +
1802+ "\x02id\x18\x04 \x01(\tR\x02id\x12\x1b\n" +
1803+ "\tcommit_id\x18\x05 \x01(\tR\bcommitId\"\x88\x01\n" +
1804+ "\x0fListRefsRequest\x12\x12\n" +
1805+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12%\n" +
1806+ "\x05kinds\x18\x02 \x03(\x0e2\x0f.ermite.RefKindR\x05kinds\x12\x1b\n" +
1807+ "\tpage_size\x18\x03 \x01(\x05R\bpageSize\x12\x1d\n" +
1808+ "\n" +
1809+ "page_token\x18\x04 \x01(\tR\tpageToken\"[\n" +
1810+ "\x10ListRefsResponse\x12\x1f\n" +
1811+ "\x04refs\x18\x01 \x03(\v2\v.ermite.RefR\x04refs\x12&\n" +
1812+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xc3\x01\n" +
1813+ "\tTreeEntry\x12\x12\n" +
1814+ "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" +
1815+ "\x04path\x18\x02 \x01(\tR\x04path\x12%\n" +
1816+ "\x04kind\x18\x03 \x01(\x0e2\x11.ermite.EntryKindR\x04kind\x12\x12\n" +
1817+ "\x04mode\x18\x04 \x01(\rR\x04mode\x12\x0e\n" +
1818+ "\x02id\x18\x05 \x01(\tR\x02id\x12\x12\n" +
1819+ "\x04size\x18\x06 \x01(\x03R\x04size\x12/\n" +
1820+ "\vlast_commit\x18\a \x01(\v2\x0e.ermite.CommitR\n" +
1821+ "lastCommit\"\x84\x01\n" +
1822+ "\x0eGetTreeRequest\x12\x12\n" +
1823+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1824+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1825+ "\x04path\x18\x03 \x01(\tR\x04path\x12.\n" +
1826+ "\x13include_last_commit\x18\x04 \x01(\bR\x11includeLastCommit\"t\n" +
1827+ "\x0fGetTreeResponse\x12\x1b\n" +
1828+ "\tcommit_id\x18\x01 \x01(\tR\bcommitId\x12\x17\n" +
1829+ "\atree_id\x18\x02 \x01(\tR\x06treeId\x12+\n" +
1830+ "\aentries\x18\x03 \x03(\v2\x11.ermite.TreeEntryR\aentries\"\x8d\x01\n" +
1831+ "\bBlobInfo\x12\x0e\n" +
1832+ "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
1833+ "\x04path\x18\x02 \x01(\tR\x04path\x12\x12\n" +
1834+ "\x04size\x18\x03 \x01(\x03R\x04size\x12\x16\n" +
1835+ "\x06binary\x18\x04 \x01(\bR\x06binary\x12\x1d\n" +
1836+ "\n" +
1837+ "media_type\x18\x05 \x01(\tR\tmediaType\x12\x12\n" +
1838+ "\x04mode\x18\x06 \x01(\rR\x04mode\"T\n" +
1839+ "\x0eGetBlobRequest\x12\x12\n" +
1840+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1841+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1842+ "\x04path\x18\x03 \x01(\tR\x04path\"M\n" +
1843+ "\x0fGetBlobResponse\x12$\n" +
1844+ "\x04info\x18\x01 \x01(\v2\x10.ermite.BlobInfoR\x04info\x12\x14\n" +
1845+ "\x05chunk\x18\x02 \x01(\fR\x05chunk\"\x94\x01\n" +
1846+ "\x12ListCommitsRequest\x12\x12\n" +
1847+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1848+ "\brevision\x18\x02 \x01(\tR\brevision\x12\x12\n" +
1849+ "\x04path\x18\x03 \x01(\tR\x04path\x12\x1b\n" +
1850+ "\tpage_size\x18\x04 \x01(\x05R\bpageSize\x12\x1d\n" +
1851+ "\n" +
1852+ "page_token\x18\x05 \x01(\tR\tpageToken\"g\n" +
1853+ "\x13ListCommitsResponse\x12(\n" +
1854+ "\acommits\x18\x01 \x03(\v2\x0e.ermite.CommitR\acommits\x12&\n" +
1855+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"B\n" +
1856+ "\x10GetCommitRequest\x12\x12\n" +
1857+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1858+ "\brevision\x18\x02 \x01(\tR\brevision\"\x86\x01\n" +
1859+ "\x11GetCommitResponse\x12&\n" +
1860+ "\x06commit\x18\x01 \x01(\v2\x0e.ermite.CommitR\x06commit\x12'\n" +
1861+ "\x05stats\x18\x02 \x01(\v2\x11.ermite.DiffStatsR\x05stats\x12 \n" +
1862+ "\x04diff\x18\x03 \x01(\v2\f.ermite.DiffR\x04diff\"l\n" +
1863+ "\tDiffStats\x12#\n" +
1864+ "\rfiles_changed\x18\x01 \x01(\x05R\ffilesChanged\x12\x1c\n" +
1865+ "\tadditions\x18\x02 \x01(\x05R\tadditions\x12\x1c\n" +
1866+ "\tdeletions\x18\x03 \x01(\x05R\tdeletions\"L\n" +
1867+ "\x04Diff\x12&\n" +
1868+ "\x05files\x18\x01 \x03(\v2\x10.ermite.FileDiffR\x05files\x12\x1c\n" +
1869+ "\ttruncated\x18\x02 \x01(\bR\ttruncated\"\x86\x03\n" +
1870+ "\bFileDiff\x12\x19\n" +
1871+ "\bold_path\x18\x01 \x01(\tR\aoldPath\x12\x19\n" +
1872+ "\bnew_path\x18\x02 \x01(\tR\anewPath\x12*\n" +
1873+ "\x06status\x18\x03 \x01(\x0e2\x12.ermite.FileStatusR\x06status\x12\x19\n" +
1874+ "\bold_mode\x18\x04 \x01(\rR\aoldMode\x12\x19\n" +
1875+ "\bnew_mode\x18\x05 \x01(\rR\anewMode\x12\x15\n" +
1876+ "\x06old_id\x18\x06 \x01(\tR\x05oldId\x12\x15\n" +
1877+ "\x06new_id\x18\a \x01(\tR\x05newId\x12\x16\n" +
1878+ "\x06binary\x18\b \x01(\bR\x06binary\x12\x1c\n" +
1879+ "\tadditions\x18\t \x01(\x05R\tadditions\x12\x1c\n" +
1880+ "\tdeletions\x18\n" +
1881+ " \x01(\x05R\tdeletions\x12\x1e\n" +
1882+ "\n" +
1883+ "similarity\x18\v \x01(\x05R\n" +
1884+ "similarity\x12\x1c\n" +
1885+ "\ttruncated\x18\f \x01(\bR\ttruncated\x12\"\n" +
1886+ "\x05hunks\x18\r \x03(\v2\f.ermite.HunkR\x05hunks\"\xb6\x01\n" +
1887+ "\x04Hunk\x12\x1b\n" +
1888+ "\told_start\x18\x01 \x01(\x05R\boldStart\x12\x1b\n" +
1889+ "\told_lines\x18\x02 \x01(\x05R\boldLines\x12\x1b\n" +
1890+ "\tnew_start\x18\x03 \x01(\x05R\bnewStart\x12\x1b\n" +
1891+ "\tnew_lines\x18\x04 \x01(\x05R\bnewLines\x12\x16\n" +
1892+ "\x06header\x18\x05 \x01(\tR\x06header\x12\"\n" +
1893+ "\x05lines\x18\x06 \x03(\v2\f.ermite.LineR\x05lines\"\xa9\x01\n" +
1894+ "\x04Line\x12$\n" +
1895+ "\x04kind\x18\x01 \x01(\x0e2\x10.ermite.LineKindR\x04kind\x12\x1d\n" +
1896+ "\n" +
1897+ "old_number\x18\x02 \x01(\x05R\toldNumber\x12\x1d\n" +
1898+ "\n" +
1899+ "new_number\x18\x03 \x01(\x05R\tnewNumber\x12\x12\n" +
1900+ "\x04text\x18\x04 \x01(\tR\x04text\x12)\n" +
1901+ "\x11no_newline_at_eof\x18\x05 \x01(\bR\x0enoNewlineAtEof\"H\n" +
1902+ "\x16ResolveRevisionRequest\x12\x12\n" +
1903+ "\x04repo\x18\x01 \x01(\tR\x04repo\x12\x1a\n" +
1904+ "\brevision\x18\x02 \x01(\tR\brevision\"H\n" +
1905+ "\x17ResolveRevisionResponse\x12\x1b\n" +
1906+ "\tcommit_id\x18\x01 \x01(\tR\bcommitId\x12\x10\n" +
1907+ "\x03ref\x18\x02 \x01(\tR\x03ref*]\n" +
1908+ "\aRefKind\x12\x18\n" +
1909+ "\x14REF_KIND_UNSPECIFIED\x10\x00\x12\x13\n" +
1910+ "\x0fREF_KIND_BRANCH\x10\x01\x12\x10\n" +
1911+ "\fREF_KIND_TAG\x10\x02\x12\x11\n" +
1912+ "\rREF_KIND_HEAD\x10\x03*\xa3\x01\n" +
1913+ "\tEntryKind\x12\x1a\n" +
1914+ "\x16ENTRY_KIND_UNSPECIFIED\x10\x00\x12\x13\n" +
1915+ "\x0fENTRY_KIND_FILE\x10\x01\x12\x19\n" +
1916+ "\x15ENTRY_KIND_EXECUTABLE\x10\x02\x12\x18\n" +
1917+ "\x14ENTRY_KIND_DIRECTORY\x10\x03\x12\x16\n" +
1918+ "\x12ENTRY_KIND_SYMLINK\x10\x04\x12\x18\n" +
1919+ "\x14ENTRY_KIND_SUBMODULE\x10\x05*\xc2\x01\n" +
1920+ "\n" +
1921+ "FileStatus\x12\x1b\n" +
1922+ "\x17FILE_STATUS_UNSPECIFIED\x10\x00\x12\x15\n" +
1923+ "\x11FILE_STATUS_ADDED\x10\x01\x12\x17\n" +
1924+ "\x13FILE_STATUS_DELETED\x10\x02\x12\x18\n" +
1925+ "\x14FILE_STATUS_MODIFIED\x10\x03\x12\x17\n" +
1926+ "\x13FILE_STATUS_RENAMED\x10\x04\x12\x16\n" +
1927+ "\x12FILE_STATUS_COPIED\x10\x05\x12\x1c\n" +
1928+ "\x18FILE_STATUS_TYPE_CHANGED\x10\x06*l\n" +
1929+ "\bLineKind\x12\x19\n" +
1930+ "\x15LINE_KIND_UNSPECIFIED\x10\x00\x12\x15\n" +
1931+ "\x11LINE_KIND_CONTEXT\x10\x01\x12\x16\n" +
1932+ "\x12LINE_KIND_ADDITION\x10\x02\x12\x16\n" +
1933+ "\x12LINE_KIND_DELETION\x10\x032\xa3\x03\n" +
1934+ "\n" +
1935+ "GitService\x12=\n" +
1936+ "\bListRefs\x12\x17.ermite.ListRefsRequest\x1a\x18.ermite.ListRefsResponse\x12:\n" +
1937+ "\aGetTree\x12\x16.ermite.GetTreeRequest\x1a\x17.ermite.GetTreeResponse\x12<\n" +
1938+ "\aGetBlob\x12\x16.ermite.GetBlobRequest\x1a\x17.ermite.GetBlobResponse0\x01\x12F\n" +
1939+ "\vListCommits\x12\x1a.ermite.ListCommitsRequest\x1a\x1b.ermite.ListCommitsResponse\x12@\n" +
1940+ "\tGetCommit\x12\x18.ermite.GetCommitRequest\x1a\x19.ermite.GetCommitResponse\x12R\n" +
1941+ "\x0fResolveRevision\x12\x1e.ermite.ResolveRevisionRequest\x1a\x1f.ermite.ResolveRevisionResponseBo\n" +
1942+ "\n" +
1943+ "com.ermiteB\bGitProtoP\x01Z\x1fbnema.dev/ermite-api/gen/ermite\xa2\x02\x03EXX\xaa\x02\x06Ermite\xca\x02\x06Ermite\xe2\x02\x12Ermite\\GPBMetadata\xea\x02\x06Ermiteb\x06proto3"
1944+
1945+var (
1946+ file_ermite_git_proto_rawDescOnce sync.Once
1947+ file_ermite_git_proto_rawDescData []byte
1948+)
1949+
1950+func file_ermite_git_proto_rawDescGZIP() []byte {
1951+ file_ermite_git_proto_rawDescOnce.Do(func() {
1952+ file_ermite_git_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ermite_git_proto_rawDesc), len(file_ermite_git_proto_rawDesc)))
1953+ })
1954+ return file_ermite_git_proto_rawDescData
1955+}
1956+
1957+var file_ermite_git_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
1958+var file_ermite_git_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
1959+var file_ermite_git_proto_goTypes = []any{
1960+ (RefKind)(0), // 0: ermite.RefKind
1961+ (EntryKind)(0), // 1: ermite.EntryKind
1962+ (FileStatus)(0), // 2: ermite.FileStatus
1963+ (LineKind)(0), // 3: ermite.LineKind
1964+ (*Ref)(nil), // 4: ermite.Ref
1965+ (*ListRefsRequest)(nil), // 5: ermite.ListRefsRequest
1966+ (*ListRefsResponse)(nil), // 6: ermite.ListRefsResponse
1967+ (*TreeEntry)(nil), // 7: ermite.TreeEntry
1968+ (*GetTreeRequest)(nil), // 8: ermite.GetTreeRequest
1969+ (*GetTreeResponse)(nil), // 9: ermite.GetTreeResponse
1970+ (*BlobInfo)(nil), // 10: ermite.BlobInfo
1971+ (*GetBlobRequest)(nil), // 11: ermite.GetBlobRequest
1972+ (*GetBlobResponse)(nil), // 12: ermite.GetBlobResponse
1973+ (*ListCommitsRequest)(nil), // 13: ermite.ListCommitsRequest
1974+ (*ListCommitsResponse)(nil), // 14: ermite.ListCommitsResponse
1975+ (*GetCommitRequest)(nil), // 15: ermite.GetCommitRequest
1976+ (*GetCommitResponse)(nil), // 16: ermite.GetCommitResponse
1977+ (*DiffStats)(nil), // 17: ermite.DiffStats
1978+ (*Diff)(nil), // 18: ermite.Diff
1979+ (*FileDiff)(nil), // 19: ermite.FileDiff
1980+ (*Hunk)(nil), // 20: ermite.Hunk
1981+ (*Line)(nil), // 21: ermite.Line
1982+ (*ResolveRevisionRequest)(nil), // 22: ermite.ResolveRevisionRequest
1983+ (*ResolveRevisionResponse)(nil), // 23: ermite.ResolveRevisionResponse
1984+ (*Commit)(nil), // 24: ermite.Commit
1985+}
1986+var file_ermite_git_proto_depIdxs = []int32{
1987+ 0, // 0: ermite.Ref.kind:type_name -> ermite.RefKind
1988+ 0, // 1: ermite.ListRefsRequest.kinds:type_name -> ermite.RefKind
1989+ 4, // 2: ermite.ListRefsResponse.refs:type_name -> ermite.Ref
1990+ 1, // 3: ermite.TreeEntry.kind:type_name -> ermite.EntryKind
1991+ 24, // 4: ermite.TreeEntry.last_commit:type_name -> ermite.Commit
1992+ 7, // 5: ermite.GetTreeResponse.entries:type_name -> ermite.TreeEntry
1993+ 10, // 6: ermite.GetBlobResponse.info:type_name -> ermite.BlobInfo
1994+ 24, // 7: ermite.ListCommitsResponse.commits:type_name -> ermite.Commit
1995+ 24, // 8: ermite.GetCommitResponse.commit:type_name -> ermite.Commit
1996+ 17, // 9: ermite.GetCommitResponse.stats:type_name -> ermite.DiffStats
1997+ 18, // 10: ermite.GetCommitResponse.diff:type_name -> ermite.Diff
1998+ 19, // 11: ermite.Diff.files:type_name -> ermite.FileDiff
1999+ 2, // 12: ermite.FileDiff.status:type_name -> ermite.FileStatus
2000+ 20, // 13: ermite.FileDiff.hunks:type_name -> ermite.Hunk
2001+ 21, // 14: ermite.Hunk.lines:type_name -> ermite.Line
2002+ 3, // 15: ermite.Line.kind:type_name -> ermite.LineKind
2003+ 5, // 16: ermite.GitService.ListRefs:input_type -> ermite.ListRefsRequest
2004+ 8, // 17: ermite.GitService.GetTree:input_type -> ermite.GetTreeRequest
2005+ 11, // 18: ermite.GitService.GetBlob:input_type -> ermite.GetBlobRequest
2006+ 13, // 19: ermite.GitService.ListCommits:input_type -> ermite.ListCommitsRequest
2007+ 15, // 20: ermite.GitService.GetCommit:input_type -> ermite.GetCommitRequest
2008+ 22, // 21: ermite.GitService.ResolveRevision:input_type -> ermite.ResolveRevisionRequest
2009+ 6, // 22: ermite.GitService.ListRefs:output_type -> ermite.ListRefsResponse
2010+ 9, // 23: ermite.GitService.GetTree:output_type -> ermite.GetTreeResponse
2011+ 12, // 24: ermite.GitService.GetBlob:output_type -> ermite.GetBlobResponse
2012+ 14, // 25: ermite.GitService.ListCommits:output_type -> ermite.ListCommitsResponse
2013+ 16, // 26: ermite.GitService.GetCommit:output_type -> ermite.GetCommitResponse
2014+ 23, // 27: ermite.GitService.ResolveRevision:output_type -> ermite.ResolveRevisionResponse
2015+ 22, // [22:28] is the sub-list for method output_type
2016+ 16, // [16:22] is the sub-list for method input_type
2017+ 16, // [16:16] is the sub-list for extension type_name
2018+ 16, // [16:16] is the sub-list for extension extendee
2019+ 0, // [0:16] is the sub-list for field type_name
2020+}
2021+
2022+func init() { file_ermite_git_proto_init() }
2023+func file_ermite_git_proto_init() {
2024+ if File_ermite_git_proto != nil {
2025+ return
2026+ }
2027+ file_ermite_types_proto_init()
2028+ type x struct{}
2029+ out := protoimpl.TypeBuilder{
2030+ File: protoimpl.DescBuilder{
2031+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
2032+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_ermite_git_proto_rawDesc), len(file_ermite_git_proto_rawDesc)),
2033+ NumEnums: 4,
2034+ NumMessages: 20,
2035+ NumExtensions: 0,
2036+ NumServices: 1,
2037+ },
2038+ GoTypes: file_ermite_git_proto_goTypes,
2039+ DependencyIndexes: file_ermite_git_proto_depIdxs,
2040+ EnumInfos: file_ermite_git_proto_enumTypes,
2041+ MessageInfos: file_ermite_git_proto_msgTypes,
2042+ }.Build()
2043+ File_ermite_git_proto = out.File
2044+ file_ermite_git_proto_goTypes = nil
2045+ file_ermite_git_proto_depIdxs = nil
2046+}
A gen/ermite/repo.pb.go +857 -0 generated file: collapsed
A gen/ermite/server.pb.go +188 -0 generated file: collapsed
A gen/ermite/token.pb.go +673 -0 generated file: collapsed
A gen/ermite/types.pb.go +258 -0 generated file: collapsed
A gen_test.go +92 -0
@@ -0,0 +1,92 @@
1+// SPDX-License-Identifier: MIT
2+
3+package api_test
4+
5+import (
6+ "testing"
7+
8+ "google.golang.org/protobuf/proto"
9+ "google.golang.org/protobuf/types/known/fieldmaskpb"
10+
11+ "bnema.dev/ermite-api/gen/ermite"
12+ "bnema.dev/ermite-api/gen/ermite/ermiteconnect"
13+)
14+
15+// TestProcedures pins the procedure paths: they are the wire contract.
16+func TestProcedures(t *testing.T) {
17+ tests := []struct{ got, want string }{
18+ {ermiteconnect.RepoServiceListReposProcedure, "/ermite.RepoService/ListRepos"},
19+ {ermiteconnect.RepoServiceGetRepoProcedure, "/ermite.RepoService/GetRepo"},
20+ {ermiteconnect.RepoServiceCreateRepoProcedure, "/ermite.RepoService/CreateRepo"},
21+ {ermiteconnect.RepoServiceUpdateRepoProcedure, "/ermite.RepoService/UpdateRepo"},
22+ {ermiteconnect.RepoServiceDeleteRepoProcedure, "/ermite.RepoService/DeleteRepo"},
23+ {ermiteconnect.GitServiceListRefsProcedure, "/ermite.GitService/ListRefs"},
24+ {ermiteconnect.GitServiceGetTreeProcedure, "/ermite.GitService/GetTree"},
25+ {ermiteconnect.GitServiceGetBlobProcedure, "/ermite.GitService/GetBlob"},
26+ {ermiteconnect.GitServiceListCommitsProcedure, "/ermite.GitService/ListCommits"},
27+ {ermiteconnect.GitServiceGetCommitProcedure, "/ermite.GitService/GetCommit"},
28+ {ermiteconnect.GitServiceResolveRevisionProcedure, "/ermite.GitService/ResolveRevision"},
29+ {ermiteconnect.TokenServiceCreateTokenProcedure, "/ermite.TokenService/CreateToken"},
30+ {ermiteconnect.TokenServiceListTokensProcedure, "/ermite.TokenService/ListTokens"},
31+ {ermiteconnect.TokenServiceRevokeTokenProcedure, "/ermite.TokenService/RevokeToken"},
32+ {ermiteconnect.EventServiceWatchProcedure, "/ermite.EventService/Watch"},
33+ {ermiteconnect.ServerServiceGetVersionProcedure, "/ermite.ServerService/GetVersion"},
34+ }
35+ for _, tt := range tests {
36+ if tt.got != tt.want {
37+ t.Errorf("procedure = %q, want %q", tt.got, tt.want)
38+ }
39+ }
40+}
41+
42+// TestEnumNumbers pins enum numbers: they are part of the wire contract.
43+func TestEnumNumbers(t *testing.T) {
44+ if got := ermite.Scope_SCOPE_TOKEN_ADMIN; got != 9 {
45+ t.Errorf("SCOPE_TOKEN_ADMIN = %d, want 9", got)
46+ }
47+ if got := ermite.FileStatus_FILE_STATUS_TYPE_CHANGED; got != 6 {
48+ t.Errorf("FILE_STATUS_TYPE_CHANGED = %d, want 6", got)
49+ }
50+ if got := ermite.Visibility_VISIBILITY_PRIVATE; got != 2 {
51+ t.Errorf("VISIBILITY_PRIVATE = %d, want 2", got)
52+ }
53+}
54+
55+// TestEventRoundTrip checks that an event with a oneof kind survives the wire.
56+func TestEventRoundTrip(t *testing.T) {
57+ in := &ermite.WatchResponse{Event: &ermite.Event{
58+ Id: "42",
59+ Kind: &ermite.Event_Pushed{Pushed: &ermite.Pushed{
60+ Repo: "ermite",
61+ RefUpdates: []*ermite.RefUpdate{
62+ {Ref: "refs/heads/main", OldId: "a", NewId: "b"},
63+ },
64+ }},
65+ }}
66+ b, err := proto.Marshal(in)
67+ if err != nil {
68+ t.Fatal(err)
69+ }
70+ var out ermite.WatchResponse
71+ if err := proto.Unmarshal(b, &out); err != nil {
72+ t.Fatal(err)
73+ }
74+ if !proto.Equal(in, &out) {
75+ t.Errorf("round trip mismatch: %v != %v", &out, in)
76+ }
77+ if out.GetEvent().GetPushed().GetRefUpdates()[0].GetNewId() != "b" {
78+ t.Errorf("unexpected ref update: %v", &out)
79+ }
80+}
81+
82+// TestUpdateRepoMask checks that the request carries a field mask.
83+func TestUpdateRepoMask(t *testing.T) {
84+ req := &ermite.UpdateRepoRequest{
85+ Repo: "ermite",
86+ Visibility: ermite.Visibility_VISIBILITY_PUBLIC,
87+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}},
88+ }
89+ if got := req.GetUpdateMask().GetPaths(); len(got) != 1 || got[0] != "visibility" {
90+ t.Errorf("paths = %v", got)
91+ }
92+}
@@ -0,0 +1,92 @@
1+// SPDX-License-Identifier: MIT
2+
3+package api_test
4+
5+import (
6+ "testing"
7+
8+ "google.golang.org/protobuf/proto"
9+ "google.golang.org/protobuf/types/known/fieldmaskpb"
10+
11+ "bnema.dev/ermite-api/gen/ermite"
12+ "bnema.dev/ermite-api/gen/ermite/ermiteconnect"
13+)
14+
15+// TestProcedures pins the procedure paths: they are the wire contract.
16+func TestProcedures(t *testing.T) {
17+ tests := []struct{ got, want string }{
18+ {ermiteconnect.RepoServiceListReposProcedure, "/ermite.RepoService/ListRepos"},
19+ {ermiteconnect.RepoServiceGetRepoProcedure, "/ermite.RepoService/GetRepo"},
20+ {ermiteconnect.RepoServiceCreateRepoProcedure, "/ermite.RepoService/CreateRepo"},
21+ {ermiteconnect.RepoServiceUpdateRepoProcedure, "/ermite.RepoService/UpdateRepo"},
22+ {ermiteconnect.RepoServiceDeleteRepoProcedure, "/ermite.RepoService/DeleteRepo"},
23+ {ermiteconnect.GitServiceListRefsProcedure, "/ermite.GitService/ListRefs"},
24+ {ermiteconnect.GitServiceGetTreeProcedure, "/ermite.GitService/GetTree"},
25+ {ermiteconnect.GitServiceGetBlobProcedure, "/ermite.GitService/GetBlob"},
26+ {ermiteconnect.GitServiceListCommitsProcedure, "/ermite.GitService/ListCommits"},
27+ {ermiteconnect.GitServiceGetCommitProcedure, "/ermite.GitService/GetCommit"},
28+ {ermiteconnect.GitServiceResolveRevisionProcedure, "/ermite.GitService/ResolveRevision"},
29+ {ermiteconnect.TokenServiceCreateTokenProcedure, "/ermite.TokenService/CreateToken"},
30+ {ermiteconnect.TokenServiceListTokensProcedure, "/ermite.TokenService/ListTokens"},
31+ {ermiteconnect.TokenServiceRevokeTokenProcedure, "/ermite.TokenService/RevokeToken"},
32+ {ermiteconnect.EventServiceWatchProcedure, "/ermite.EventService/Watch"},
33+ {ermiteconnect.ServerServiceGetVersionProcedure, "/ermite.ServerService/GetVersion"},
34+ }
35+ for _, tt := range tests {
36+ if tt.got != tt.want {
37+ t.Errorf("procedure = %q, want %q", tt.got, tt.want)
38+ }
39+ }
40+}
41+
42+// TestEnumNumbers pins enum numbers: they are part of the wire contract.
43+func TestEnumNumbers(t *testing.T) {
44+ if got := ermite.Scope_SCOPE_TOKEN_ADMIN; got != 9 {
45+ t.Errorf("SCOPE_TOKEN_ADMIN = %d, want 9", got)
46+ }
47+ if got := ermite.FileStatus_FILE_STATUS_TYPE_CHANGED; got != 6 {
48+ t.Errorf("FILE_STATUS_TYPE_CHANGED = %d, want 6", got)
49+ }
50+ if got := ermite.Visibility_VISIBILITY_PRIVATE; got != 2 {
51+ t.Errorf("VISIBILITY_PRIVATE = %d, want 2", got)
52+ }
53+}
54+
55+// TestEventRoundTrip checks that an event with a oneof kind survives the wire.
56+func TestEventRoundTrip(t *testing.T) {
57+ in := &ermite.WatchResponse{Event: &ermite.Event{
58+ Id: "42",
59+ Kind: &ermite.Event_Pushed{Pushed: &ermite.Pushed{
60+ Repo: "ermite",
61+ RefUpdates: []*ermite.RefUpdate{
62+ {Ref: "refs/heads/main", OldId: "a", NewId: "b"},
63+ },
64+ }},
65+ }}
66+ b, err := proto.Marshal(in)
67+ if err != nil {
68+ t.Fatal(err)
69+ }
70+ var out ermite.WatchResponse
71+ if err := proto.Unmarshal(b, &out); err != nil {
72+ t.Fatal(err)
73+ }
74+ if !proto.Equal(in, &out) {
75+ t.Errorf("round trip mismatch: %v != %v", &out, in)
76+ }
77+ if out.GetEvent().GetPushed().GetRefUpdates()[0].GetNewId() != "b" {
78+ t.Errorf("unexpected ref update: %v", &out)
79+ }
80+}
81+
82+// TestUpdateRepoMask checks that the request carries a field mask.
83+func TestUpdateRepoMask(t *testing.T) {
84+ req := &ermite.UpdateRepoRequest{
85+ Repo: "ermite",
86+ Visibility: ermite.Visibility_VISIBILITY_PUBLIC,
87+ UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"visibility"}},
88+ }
89+ if got := req.GetUpdateMask().GetPaths(); len(got) != 1 || got[0] != "visibility" {
90+ t.Errorf("paths = %v", got)
91+ }
92+}
M go.mod +2 -2
@@ -8,6 +8,6 @@ tool (
88 )
99
1010 require (
11- connectrpc.com/connect v1.21.0 // indirect
12- google.golang.org/protobuf v1.36.12 // indirect
11+ connectrpc.com/connect v1.21.0
12+ google.golang.org/protobuf v1.36.12
1313 )
@@ -8,6 +8,6 @@ tool (
8 )8 )
9 9
10 require (10 require (
11- connectrpc.com/connect v1.21.0 // indirect11+ connectrpc.com/connect v1.21.0
12- google.golang.org/protobuf v1.36.12 // indirect12+ google.golang.org/protobuf v1.36.12
13 )13 )
A proto/ermite/event.proto +105 -0
@@ -0,0 +1,105 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "ermite/repo.proto";
8+import "google/protobuf/timestamp.proto";
9+
10+// EventService streams what happens on the forge.
11+service EventService {
12+ // Watch streams events until the client cancels the call or the server shuts
13+ // down. Events are filtered by the caller's access: events of a private
14+ // repository are only sent to callers that may read it.
15+ //
16+ // The server keeps a bounded buffer of recent events. With resume_after set,
17+ // buffered events after that id are replayed first, then live events follow.
18+ // When resume_after is no longer buffered (or unknown), the stream begins
19+ // with a Gap event, then continues with the oldest buffered event: the client
20+ // must reload its state. Without resume_after, only new events are sent.
21+ rpc Watch(WatchRequest) returns (stream WatchResponse);
22+}
23+
24+// WatchRequest selects the events to receive.
25+message WatchRequest {
26+ // Topics are the subjects to follow: "home" for every repository visible to
27+ // the caller, or "repo:<name>" for one repository. Empty means "home".
28+ // Unknown topics are invalid_argument. A "repo:<name>" topic for a repository
29+ // that does not exist or is not visible is not_found.
30+ repeated string topics = 1;
31+ // ResumeAfter is the Event.id of the last event the client has seen. Empty
32+ // to receive only new events.
33+ string resume_after = 2;
34+}
35+
36+// WatchResponse carries one event of the stream.
37+message WatchResponse {
38+ // Event is the event.
39+ Event event = 1;
40+}
41+
42+// Event is something that happened on the forge.
43+message Event {
44+ // Id identifies the event and is passed as resume_after to resume a stream.
45+ // It is opaque and only comparable for equality; clients must not parse it.
46+ // Empty on a Gap event.
47+ string id = 1;
48+ // Time is when the event happened.
49+ google.protobuf.Timestamp time = 2;
50+ // Kind is the type and payload of the event. New kinds may be added; clients
51+ // must ignore kinds they do not know.
52+ oneof kind {
53+ // RepoCreated: a repository was created.
54+ RepoCreated repo_created = 3;
55+ // RepoUpdated: repository metadata changed.
56+ RepoUpdated repo_updated = 4;
57+ // RepoDeleted: a repository was deleted.
58+ RepoDeleted repo_deleted = 5;
59+ // Pushed: refs of a repository were updated by a push.
60+ Pushed pushed = 6;
61+ // Gap: events were lost, reload state.
62+ Gap gap = 7;
63+ }
64+}
65+
66+// RepoCreated reports a new repository.
67+message RepoCreated {
68+ // Repo is the new repository.
69+ Repo repo = 1;
70+}
71+
72+// RepoUpdated reports a metadata change.
73+message RepoUpdated {
74+ // Repo is the repository after the change.
75+ Repo repo = 1;
76+}
77+
78+// RepoDeleted reports a deleted repository.
79+message RepoDeleted {
80+ // Repo is the name of the deleted repository.
81+ string repo = 1;
82+}
83+
84+// Pushed reports the ref updates of one push.
85+message Pushed {
86+ // Repo is the name of the repository.
87+ string repo = 1;
88+ // RefUpdates are the refs changed by the push.
89+ repeated RefUpdate ref_updates = 2;
90+}
91+
92+// RefUpdate is the change of one ref.
93+message RefUpdate {
94+ // Ref is the full ref name, for example "refs/heads/main".
95+ string ref = 1;
96+ // OldId is the object id before the update. Empty when the ref was created.
97+ string old_id = 2;
98+ // NewId is the object id after the update. Empty when the ref was deleted.
99+ string new_id = 3;
100+}
101+
102+// Gap tells the client that events were lost: the requested resume point is
103+// older than the server's buffer. It has no fields. The client should reload
104+// the state it displays (repositories, refs) and carry on with the next events.
105+message Gap {}
@@ -0,0 +1,105 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "ermite/repo.proto";
8+import "google/protobuf/timestamp.proto";
9+
10+// EventService streams what happens on the forge.
11+service EventService {
12+ // Watch streams events until the client cancels the call or the server shuts
13+ // down. Events are filtered by the caller's access: events of a private
14+ // repository are only sent to callers that may read it.
15+ //
16+ // The server keeps a bounded buffer of recent events. With resume_after set,
17+ // buffered events after that id are replayed first, then live events follow.
18+ // When resume_after is no longer buffered (or unknown), the stream begins
19+ // with a Gap event, then continues with the oldest buffered event: the client
20+ // must reload its state. Without resume_after, only new events are sent.
21+ rpc Watch(WatchRequest) returns (stream WatchResponse);
22+}
23+
24+// WatchRequest selects the events to receive.
25+message WatchRequest {
26+ // Topics are the subjects to follow: "home" for every repository visible to
27+ // the caller, or "repo:<name>" for one repository. Empty means "home".
28+ // Unknown topics are invalid_argument. A "repo:<name>" topic for a repository
29+ // that does not exist or is not visible is not_found.
30+ repeated string topics = 1;
31+ // ResumeAfter is the Event.id of the last event the client has seen. Empty
32+ // to receive only new events.
33+ string resume_after = 2;
34+}
35+
36+// WatchResponse carries one event of the stream.
37+message WatchResponse {
38+ // Event is the event.
39+ Event event = 1;
40+}
41+
42+// Event is something that happened on the forge.
43+message Event {
44+ // Id identifies the event and is passed as resume_after to resume a stream.
45+ // It is opaque and only comparable for equality; clients must not parse it.
46+ // Empty on a Gap event.
47+ string id = 1;
48+ // Time is when the event happened.
49+ google.protobuf.Timestamp time = 2;
50+ // Kind is the type and payload of the event. New kinds may be added; clients
51+ // must ignore kinds they do not know.
52+ oneof kind {
53+ // RepoCreated: a repository was created.
54+ RepoCreated repo_created = 3;
55+ // RepoUpdated: repository metadata changed.
56+ RepoUpdated repo_updated = 4;
57+ // RepoDeleted: a repository was deleted.
58+ RepoDeleted repo_deleted = 5;
59+ // Pushed: refs of a repository were updated by a push.
60+ Pushed pushed = 6;
61+ // Gap: events were lost, reload state.
62+ Gap gap = 7;
63+ }
64+}
65+
66+// RepoCreated reports a new repository.
67+message RepoCreated {
68+ // Repo is the new repository.
69+ Repo repo = 1;
70+}
71+
72+// RepoUpdated reports a metadata change.
73+message RepoUpdated {
74+ // Repo is the repository after the change.
75+ Repo repo = 1;
76+}
77+
78+// RepoDeleted reports a deleted repository.
79+message RepoDeleted {
80+ // Repo is the name of the deleted repository.
81+ string repo = 1;
82+}
83+
84+// Pushed reports the ref updates of one push.
85+message Pushed {
86+ // Repo is the name of the repository.
87+ string repo = 1;
88+ // RefUpdates are the refs changed by the push.
89+ repeated RefUpdate ref_updates = 2;
90+}
91+
92+// RefUpdate is the change of one ref.
93+message RefUpdate {
94+ // Ref is the full ref name, for example "refs/heads/main".
95+ string ref = 1;
96+ // OldId is the object id before the update. Empty when the ref was created.
97+ string old_id = 2;
98+ // NewId is the object id after the update. Empty when the ref was deleted.
99+ string new_id = 3;
100+}
101+
102+// Gap tells the client that events were lost: the requested resume point is
103+// older than the server's buffer. It has no fields. The client should reload
104+// the state it displays (repositories, refs) and carry on with the next events.
105+message Gap {}
A proto/ermite/git.proto +388 -0
@@ -0,0 +1,388 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "ermite/types.proto";
8+
9+// RefKind is the kind of a Git ref.
10+enum RefKind {
11+ // Not set. In ListRefsRequest.kinds it is rejected; never returned.
12+ REF_KIND_UNSPECIFIED = 0;
13+ // A branch (refs/heads/*).
14+ REF_KIND_BRANCH = 1;
15+ // A tag (refs/tags/*), lightweight or annotated.
16+ REF_KIND_TAG = 2;
17+ // The symbolic ref HEAD, that is the default branch.
18+ REF_KIND_HEAD = 3;
19+}
20+
21+// EntryKind is the kind of an entry of a Git tree.
22+enum EntryKind {
23+ // Not set. Never returned.
24+ ENTRY_KIND_UNSPECIFIED = 0;
25+ // A regular, non-executable file (mode 100644).
26+ ENTRY_KIND_FILE = 1;
27+ // An executable file (mode 100755).
28+ ENTRY_KIND_EXECUTABLE = 2;
29+ // A directory (mode 040000).
30+ ENTRY_KIND_DIRECTORY = 3;
31+ // A symbolic link (mode 120000). The blob content is the link target.
32+ ENTRY_KIND_SYMLINK = 4;
33+ // A submodule commit (mode 160000). The id is a commit of another
34+ // repository, which this one does not contain.
35+ ENTRY_KIND_SUBMODULE = 5;
36+}
37+
38+// FileStatus tells what a commit did to a file.
39+enum FileStatus {
40+ // Not set. Never returned.
41+ FILE_STATUS_UNSPECIFIED = 0;
42+ // The file was added.
43+ FILE_STATUS_ADDED = 1;
44+ // The file was deleted.
45+ FILE_STATUS_DELETED = 2;
46+ // The content or the mode of the file changed.
47+ FILE_STATUS_MODIFIED = 3;
48+ // The file was moved, possibly with changes. Rename detection is done by Git.
49+ FILE_STATUS_RENAMED = 4;
50+ // The file was copied from another file, possibly with changes.
51+ FILE_STATUS_COPIED = 5;
52+ // The type of the entry changed, for example a file became a symbolic link.
53+ FILE_STATUS_TYPE_CHANGED = 6;
54+}
55+
56+// LineKind tells how a line of a hunk relates to the two sides of a diff.
57+enum LineKind {
58+ // Not set. Never returned.
59+ LINE_KIND_UNSPECIFIED = 0;
60+ // The line is present, unchanged, on both sides.
61+ LINE_KIND_CONTEXT = 1;
62+ // The line exists only on the new side.
63+ LINE_KIND_ADDITION = 2;
64+ // The line exists only on the old side.
65+ LINE_KIND_DELETION = 3;
66+}
67+
68+// GitService reads the Git data of repositories. It is read-only: pushes go
69+// through Git itself.
70+//
71+// Every RPC takes the repository name. A repository that does not exist or
72+// that the caller cannot read gives not_found. A revision is a branch name, a
73+// tag name or a commit id (full, or an unambiguous abbreviation of at least 7
74+// characters); empty means HEAD. A revision or path that does not exist gives
75+// not_found; so does an empty repository, which has no commit to resolve.
76+service GitService {
77+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
78+ // ordered by kind (HEAD, branches, tags) then by name.
79+ rpc ListRefs(ListRefsRequest) returns (ListRefsResponse);
80+ // GetTree lists the entries of a directory at a revision. Fails with
81+ // not_found if the path does not exist and invalid_argument if it is not a
82+ // directory.
83+ rpc GetTree(GetTreeRequest) returns (GetTreeResponse);
84+ // GetBlob streams the content of a file at a revision, in chunks of at most
85+ // 64 KiB. The first message carries the metadata in info, then the chunks
86+ // follow; the memory used by the server does not depend on the file size.
87+ // Fails with not_found if the path does not exist and invalid_argument if it
88+ // is not a file.
89+ rpc GetBlob(GetBlobRequest) returns (stream GetBlobResponse);
90+ // ListCommits lists the history reachable from a revision, newest first
91+ // (Git's default order), optionally limited to the commits that touched a
92+ // path.
93+ rpc ListCommits(ListCommitsRequest) returns (ListCommitsResponse);
94+ // GetCommit returns one commit with its statistics and its diff.
95+ rpc GetCommit(GetCommitRequest) returns (GetCommitResponse);
96+ // ResolveRevision turns a revision into the id of the commit it designates.
97+ rpc ResolveRevision(ResolveRevisionRequest) returns (ResolveRevisionResponse);
98+}
99+
100+// Ref is a branch, a tag or HEAD.
101+message Ref {
102+ // Name is the full ref name, for example "refs/heads/main" or
103+ // "refs/tags/v1.0.0". For HEAD it is "HEAD".
104+ string name = 1;
105+ // ShortName is the name without its "refs/heads/" or "refs/tags/" prefix. For
106+ // HEAD it is the short name of the default branch, or empty if HEAD points
107+ // to a branch that does not exist yet.
108+ string short_name = 2;
109+ // Kind is the kind of the ref.
110+ RefKind kind = 3;
111+ // Id is the id of the object the ref points to. For an annotated tag it is
112+ // the id of the tag object.
113+ string id = 4;
114+ // CommitId is the id of the commit the ref designates once annotated tags are
115+ // followed. It equals id for branches and lightweight tags. It is empty for
116+ // a tag that points to something other than a commit.
117+ string commit_id = 5;
118+}
119+
120+// ListRefsRequest selects the refs to list.
121+message ListRefsRequest {
122+ // Repo is the repository name.
123+ string repo = 1;
124+ // Kinds restricts the result to these kinds. Empty means all kinds.
125+ repeated RefKind kinds = 2;
126+ // PageSize is the maximum number of refs to return. 0 means the server
127+ // default; values above the server maximum are lowered to it.
128+ int32 page_size = 3;
129+ // PageToken is the next_page_token of a previous response. Empty for the
130+ // first page.
131+ string page_token = 4;
132+}
133+
134+// ListRefsResponse is one page of refs.
135+message ListRefsResponse {
136+ // Refs are the refs of this page.
137+ repeated Ref refs = 1;
138+ // NextPageToken is passed as page_token to get the next page. Empty when
139+ // there is no next page.
140+ string next_page_token = 2;
141+}
142+
143+// TreeEntry is one entry of a directory.
144+message TreeEntry {
145+ // Name is the name of the entry in its directory, without slash.
146+ string name = 1;
147+ // Path is the path of the entry from the repository root, with "/"
148+ // separators and no leading slash.
149+ string path = 2;
150+ // Kind is the kind of the entry.
151+ EntryKind kind = 3;
152+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
153+ uint32 mode = 4;
154+ // Id is the object id of the blob, tree or submodule commit.
155+ string id = 5;
156+ // Size is the size in bytes of a file or symbolic link. It is 0 for
157+ // directories and submodules.
158+ int64 size = 6;
159+ // LastCommit is the latest commit that changed the entry. Set only when the
160+ // request asked for it with include_last_commit.
161+ Commit last_commit = 7;
162+}
163+
164+// GetTreeRequest selects a directory.
165+message GetTreeRequest {
166+ // Repo is the repository name.
167+ string repo = 1;
168+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
169+ string revision = 2;
170+ // Path is the directory, from the repository root, with "/" separators.
171+ // Empty means the root.
172+ string path = 3;
173+ // IncludeLastCommit asks for the last commit of every entry in last_commit.
174+ // It costs one history walk, so it is off by default and the server may be
175+ // slow on large directories.
176+ bool include_last_commit = 4;
177+}
178+
179+// GetTreeResponse lists a directory.
180+message GetTreeResponse {
181+ // CommitId is the id of the commit the revision resolved to.
182+ string commit_id = 1;
183+ // TreeId is the object id of the listed directory.
184+ string tree_id = 2;
185+ // Entries are the entries of the directory: directories first, then the other
186+ // entries, each group ordered by name.
187+ repeated TreeEntry entries = 3;
188+}
189+
190+// BlobInfo describes a file.
191+message BlobInfo {
192+ // Id is the object id of the blob.
193+ string id = 1;
194+ // Path is the path of the file from the repository root.
195+ string path = 2;
196+ // Size is the size of the whole content in bytes.
197+ int64 size = 3;
198+ // Binary is true if the content is binary, with Git's rule: a NUL byte in the
199+ // first 8,000 bytes.
200+ bool binary = 4;
201+ // MediaType is the detected media type, for example "text/plain" or
202+ // "image/png", from the file name and the first bytes. It is
203+ // "application/octet-stream" when unknown.
204+ string media_type = 5;
205+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
206+ uint32 mode = 6;
207+}
208+
209+// GetBlobRequest selects a file.
210+message GetBlobRequest {
211+ // Repo is the repository name.
212+ string repo = 1;
213+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
214+ string revision = 2;
215+ // Path is the file, from the repository root. It is required.
216+ string path = 3;
217+}
218+
219+// GetBlobResponse is one message of the content stream.
220+message GetBlobResponse {
221+ // Info describes the file. Set in the first message of the stream only.
222+ BlobInfo info = 1;
223+ // Chunk is the next part of the content, at most 64 KiB, in order. The first
224+ // message may have an empty chunk. The chunks of a stream add up to
225+ // info.size bytes.
226+ bytes chunk = 2;
227+}
228+
229+// ListCommitsRequest selects a page of history.
230+message ListCommitsRequest {
231+ // Repo is the repository name.
232+ string repo = 1;
233+ // Revision is where the history starts: a branch, a tag or a commit id.
234+ // Empty means HEAD.
235+ string revision = 2;
236+ // Path restricts the result to the commits that changed this file or
237+ // directory. Empty means the whole history.
238+ string path = 3;
239+ // PageSize is the maximum number of commits to return. 0 means the server
240+ // default; values above 100 are lowered to 100.
241+ int32 page_size = 4;
242+ // PageToken is the next_page_token of a previous response, to continue the
243+ // same listing. Empty for the first page. Other fields must be unchanged.
244+ string page_token = 5;
245+}
246+
247+// ListCommitsResponse is one page of commits.
248+message ListCommitsResponse {
249+ // Commits are the commits of this page, newest first.
250+ repeated Commit commits = 1;
251+ // NextPageToken is passed as page_token to get the next page. Empty when
252+ // there is no next page.
253+ string next_page_token = 2;
254+}
255+
256+// GetCommitRequest selects a commit.
257+message GetCommitRequest {
258+ // Repo is the repository name.
259+ string repo = 1;
260+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
261+ string revision = 2;
262+}
263+
264+// GetCommitResponse holds a commit, its statistics and its diff.
265+message GetCommitResponse {
266+ // Commit is the commit metadata.
267+ Commit commit = 1;
268+ // Stats are the totals over all the changed files, including files that the
269+ // diff omits or truncates.
270+ DiffStats stats = 2;
271+ // Diff is the structured diff against the first parent, or against the empty
272+ // tree for a root commit. For a merge commit this is the change relative to
273+ // the first parent.
274+ Diff diff = 3;
275+}
276+
277+// DiffStats are the totals of a diff.
278+message DiffStats {
279+ // FilesChanged is the number of changed files.
280+ int32 files_changed = 1;
281+ // Additions is the number of added lines. Binary files count for 0.
282+ int32 additions = 2;
283+ // Deletions is the number of deleted lines. Binary files count for 0.
284+ int32 deletions = 3;
285+}
286+
287+// Diff is the structured difference introduced by a commit.
288+//
289+// The server limits its size: at most 300 files, at most 2,000 lines in one
290+// file and at most 20,000 lines in total (hunk lines, context included). These
291+// numbers are server behaviour and may change; clients must rely on the
292+// truncated flags, not on the numbers.
293+message Diff {
294+ // Files are the changed files, ordered by path. Files past the file limit are
295+ // omitted.
296+ repeated FileDiff files = 1;
297+ // Truncated is true when the diff is incomplete: files were omitted, or at
298+ // least one listed file has truncated set. DiffStats still count everything.
299+ bool truncated = 2;
300+}
301+
302+// FileDiff is the change of one file.
303+message FileDiff {
304+ // OldPath is the path before the commit. Empty for an added file.
305+ string old_path = 1;
306+ // NewPath is the path after the commit. Empty for a deleted file.
307+ string new_path = 2;
308+ // Status tells what happened to the file.
309+ FileStatus status = 3;
310+ // OldMode is the Git file mode before the commit, or 0 for an added file.
311+ uint32 old_mode = 4;
312+ // NewMode is the Git file mode after the commit, or 0 for a deleted file.
313+ uint32 new_mode = 5;
314+ // OldId is the blob id before the commit. Empty for an added file.
315+ string old_id = 6;
316+ // NewId is the blob id after the commit. Empty for a deleted file.
317+ string new_id = 7;
318+ // Binary is true if Git treats the file as binary (numstat reports "-"). A
319+ // binary file has no hunks and additions and deletions are 0.
320+ bool binary = 8;
321+ // Additions is the number of added lines.
322+ int32 additions = 9;
323+ // Deletions is the number of deleted lines.
324+ int32 deletions = 10;
325+ // Similarity is the percentage (0-100) of unchanged content for a renamed or
326+ // copied file, and 0 otherwise.
327+ int32 similarity = 11;
328+ // Truncated is true when the file exceeded a diff limit: hunks is then empty
329+ // although the file changed. Additions and deletions remain accurate.
330+ bool truncated = 12;
331+ // Hunks are the changed regions, in file order. Empty for a binary file, a
332+ // truncated file, a pure rename and a mode-only change.
333+ repeated Hunk hunks = 13;
334+}
335+
336+// Hunk is a contiguous changed region with its context.
337+message Hunk {
338+ // OldStart is the 1-based first line of the region in the old file. 0 when
339+ // old_lines is 0 and the file was added.
340+ int32 old_start = 1;
341+ // OldLines is the number of old-side lines in the hunk.
342+ int32 old_lines = 2;
343+ // NewStart is the 1-based first line of the region in the new file. 0 when
344+ // new_lines is 0 and the file was deleted.
345+ int32 new_start = 3;
346+ // NewLines is the number of new-side lines in the hunk.
347+ int32 new_lines = 4;
348+ // Header is the text after the second "@@" of the hunk header, usually the
349+ // enclosing function. It may be empty.
350+ string header = 5;
351+ // Lines are the lines of the hunk, in order.
352+ repeated Line lines = 6;
353+}
354+
355+// Line is one line of a hunk.
356+message Line {
357+ // Kind tells which side the line belongs to.
358+ LineKind kind = 1;
359+ // OldNumber is the 1-based line number on the old side. 0 for an addition.
360+ int32 old_number = 2;
361+ // NewNumber is the 1-based line number on the new side. 0 for a deletion.
362+ int32 new_number = 3;
363+ // Text is the content without the line terminator. Bytes that are not valid
364+ // UTF-8 are replaced by the replacement character.
365+ string text = 4;
366+ // NoNewlineAtEof is true when this is the last line of its side and the file
367+ // does not end with a line break there.
368+ bool no_newline_at_eof = 5;
369+}
370+
371+// ResolveRevisionRequest names a revision.
372+message ResolveRevisionRequest {
373+ // Repo is the repository name.
374+ string repo = 1;
375+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
376+ string revision = 2;
377+}
378+
379+// ResolveRevisionResponse holds the resolved commit.
380+message ResolveRevisionResponse {
381+ // CommitId is the full id of the commit the revision designates, after
382+ // following annotated tags.
383+ string commit_id = 1;
384+ // Ref is the full name of the ref the revision matched, for example
385+ // "refs/heads/main". Empty when the revision was a commit id or for HEAD
386+ // when it is resolved by default.
387+ string ref = 2;
388+}
@@ -0,0 +1,388 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "ermite/types.proto";
8+
9+// RefKind is the kind of a Git ref.
10+enum RefKind {
11+ // Not set. In ListRefsRequest.kinds it is rejected; never returned.
12+ REF_KIND_UNSPECIFIED = 0;
13+ // A branch (refs/heads/*).
14+ REF_KIND_BRANCH = 1;
15+ // A tag (refs/tags/*), lightweight or annotated.
16+ REF_KIND_TAG = 2;
17+ // The symbolic ref HEAD, that is the default branch.
18+ REF_KIND_HEAD = 3;
19+}
20+
21+// EntryKind is the kind of an entry of a Git tree.
22+enum EntryKind {
23+ // Not set. Never returned.
24+ ENTRY_KIND_UNSPECIFIED = 0;
25+ // A regular, non-executable file (mode 100644).
26+ ENTRY_KIND_FILE = 1;
27+ // An executable file (mode 100755).
28+ ENTRY_KIND_EXECUTABLE = 2;
29+ // A directory (mode 040000).
30+ ENTRY_KIND_DIRECTORY = 3;
31+ // A symbolic link (mode 120000). The blob content is the link target.
32+ ENTRY_KIND_SYMLINK = 4;
33+ // A submodule commit (mode 160000). The id is a commit of another
34+ // repository, which this one does not contain.
35+ ENTRY_KIND_SUBMODULE = 5;
36+}
37+
38+// FileStatus tells what a commit did to a file.
39+enum FileStatus {
40+ // Not set. Never returned.
41+ FILE_STATUS_UNSPECIFIED = 0;
42+ // The file was added.
43+ FILE_STATUS_ADDED = 1;
44+ // The file was deleted.
45+ FILE_STATUS_DELETED = 2;
46+ // The content or the mode of the file changed.
47+ FILE_STATUS_MODIFIED = 3;
48+ // The file was moved, possibly with changes. Rename detection is done by Git.
49+ FILE_STATUS_RENAMED = 4;
50+ // The file was copied from another file, possibly with changes.
51+ FILE_STATUS_COPIED = 5;
52+ // The type of the entry changed, for example a file became a symbolic link.
53+ FILE_STATUS_TYPE_CHANGED = 6;
54+}
55+
56+// LineKind tells how a line of a hunk relates to the two sides of a diff.
57+enum LineKind {
58+ // Not set. Never returned.
59+ LINE_KIND_UNSPECIFIED = 0;
60+ // The line is present, unchanged, on both sides.
61+ LINE_KIND_CONTEXT = 1;
62+ // The line exists only on the new side.
63+ LINE_KIND_ADDITION = 2;
64+ // The line exists only on the old side.
65+ LINE_KIND_DELETION = 3;
66+}
67+
68+// GitService reads the Git data of repositories. It is read-only: pushes go
69+// through Git itself.
70+//
71+// Every RPC takes the repository name. A repository that does not exist or
72+// that the caller cannot read gives not_found. A revision is a branch name, a
73+// tag name or a commit id (full, or an unambiguous abbreviation of at least 7
74+// characters); empty means HEAD. A revision or path that does not exist gives
75+// not_found; so does an empty repository, which has no commit to resolve.
76+service GitService {
77+ // ListRefs lists the branches, tags and HEAD of a repository. Refs are
78+ // ordered by kind (HEAD, branches, tags) then by name.
79+ rpc ListRefs(ListRefsRequest) returns (ListRefsResponse);
80+ // GetTree lists the entries of a directory at a revision. Fails with
81+ // not_found if the path does not exist and invalid_argument if it is not a
82+ // directory.
83+ rpc GetTree(GetTreeRequest) returns (GetTreeResponse);
84+ // GetBlob streams the content of a file at a revision, in chunks of at most
85+ // 64 KiB. The first message carries the metadata in info, then the chunks
86+ // follow; the memory used by the server does not depend on the file size.
87+ // Fails with not_found if the path does not exist and invalid_argument if it
88+ // is not a file.
89+ rpc GetBlob(GetBlobRequest) returns (stream GetBlobResponse);
90+ // ListCommits lists the history reachable from a revision, newest first
91+ // (Git's default order), optionally limited to the commits that touched a
92+ // path.
93+ rpc ListCommits(ListCommitsRequest) returns (ListCommitsResponse);
94+ // GetCommit returns one commit with its statistics and its diff.
95+ rpc GetCommit(GetCommitRequest) returns (GetCommitResponse);
96+ // ResolveRevision turns a revision into the id of the commit it designates.
97+ rpc ResolveRevision(ResolveRevisionRequest) returns (ResolveRevisionResponse);
98+}
99+
100+// Ref is a branch, a tag or HEAD.
101+message Ref {
102+ // Name is the full ref name, for example "refs/heads/main" or
103+ // "refs/tags/v1.0.0". For HEAD it is "HEAD".
104+ string name = 1;
105+ // ShortName is the name without its "refs/heads/" or "refs/tags/" prefix. For
106+ // HEAD it is the short name of the default branch, or empty if HEAD points
107+ // to a branch that does not exist yet.
108+ string short_name = 2;
109+ // Kind is the kind of the ref.
110+ RefKind kind = 3;
111+ // Id is the id of the object the ref points to. For an annotated tag it is
112+ // the id of the tag object.
113+ string id = 4;
114+ // CommitId is the id of the commit the ref designates once annotated tags are
115+ // followed. It equals id for branches and lightweight tags. It is empty for
116+ // a tag that points to something other than a commit.
117+ string commit_id = 5;
118+}
119+
120+// ListRefsRequest selects the refs to list.
121+message ListRefsRequest {
122+ // Repo is the repository name.
123+ string repo = 1;
124+ // Kinds restricts the result to these kinds. Empty means all kinds.
125+ repeated RefKind kinds = 2;
126+ // PageSize is the maximum number of refs to return. 0 means the server
127+ // default; values above the server maximum are lowered to it.
128+ int32 page_size = 3;
129+ // PageToken is the next_page_token of a previous response. Empty for the
130+ // first page.
131+ string page_token = 4;
132+}
133+
134+// ListRefsResponse is one page of refs.
135+message ListRefsResponse {
136+ // Refs are the refs of this page.
137+ repeated Ref refs = 1;
138+ // NextPageToken is passed as page_token to get the next page. Empty when
139+ // there is no next page.
140+ string next_page_token = 2;
141+}
142+
143+// TreeEntry is one entry of a directory.
144+message TreeEntry {
145+ // Name is the name of the entry in its directory, without slash.
146+ string name = 1;
147+ // Path is the path of the entry from the repository root, with "/"
148+ // separators and no leading slash.
149+ string path = 2;
150+ // Kind is the kind of the entry.
151+ EntryKind kind = 3;
152+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
153+ uint32 mode = 4;
154+ // Id is the object id of the blob, tree or submodule commit.
155+ string id = 5;
156+ // Size is the size in bytes of a file or symbolic link. It is 0 for
157+ // directories and submodules.
158+ int64 size = 6;
159+ // LastCommit is the latest commit that changed the entry. Set only when the
160+ // request asked for it with include_last_commit.
161+ Commit last_commit = 7;
162+}
163+
164+// GetTreeRequest selects a directory.
165+message GetTreeRequest {
166+ // Repo is the repository name.
167+ string repo = 1;
168+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
169+ string revision = 2;
170+ // Path is the directory, from the repository root, with "/" separators.
171+ // Empty means the root.
172+ string path = 3;
173+ // IncludeLastCommit asks for the last commit of every entry in last_commit.
174+ // It costs one history walk, so it is off by default and the server may be
175+ // slow on large directories.
176+ bool include_last_commit = 4;
177+}
178+
179+// GetTreeResponse lists a directory.
180+message GetTreeResponse {
181+ // CommitId is the id of the commit the revision resolved to.
182+ string commit_id = 1;
183+ // TreeId is the object id of the listed directory.
184+ string tree_id = 2;
185+ // Entries are the entries of the directory: directories first, then the other
186+ // entries, each group ordered by name.
187+ repeated TreeEntry entries = 3;
188+}
189+
190+// BlobInfo describes a file.
191+message BlobInfo {
192+ // Id is the object id of the blob.
193+ string id = 1;
194+ // Path is the path of the file from the repository root.
195+ string path = 2;
196+ // Size is the size of the whole content in bytes.
197+ int64 size = 3;
198+ // Binary is true if the content is binary, with Git's rule: a NUL byte in the
199+ // first 8,000 bytes.
200+ bool binary = 4;
201+ // MediaType is the detected media type, for example "text/plain" or
202+ // "image/png", from the file name and the first bytes. It is
203+ // "application/octet-stream" when unknown.
204+ string media_type = 5;
205+ // Mode is the Git file mode, for example 0o100644 (33188 in decimal).
206+ uint32 mode = 6;
207+}
208+
209+// GetBlobRequest selects a file.
210+message GetBlobRequest {
211+ // Repo is the repository name.
212+ string repo = 1;
213+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
214+ string revision = 2;
215+ // Path is the file, from the repository root. It is required.
216+ string path = 3;
217+}
218+
219+// GetBlobResponse is one message of the content stream.
220+message GetBlobResponse {
221+ // Info describes the file. Set in the first message of the stream only.
222+ BlobInfo info = 1;
223+ // Chunk is the next part of the content, at most 64 KiB, in order. The first
224+ // message may have an empty chunk. The chunks of a stream add up to
225+ // info.size bytes.
226+ bytes chunk = 2;
227+}
228+
229+// ListCommitsRequest selects a page of history.
230+message ListCommitsRequest {
231+ // Repo is the repository name.
232+ string repo = 1;
233+ // Revision is where the history starts: a branch, a tag or a commit id.
234+ // Empty means HEAD.
235+ string revision = 2;
236+ // Path restricts the result to the commits that changed this file or
237+ // directory. Empty means the whole history.
238+ string path = 3;
239+ // PageSize is the maximum number of commits to return. 0 means the server
240+ // default; values above 100 are lowered to 100.
241+ int32 page_size = 4;
242+ // PageToken is the next_page_token of a previous response, to continue the
243+ // same listing. Empty for the first page. Other fields must be unchanged.
244+ string page_token = 5;
245+}
246+
247+// ListCommitsResponse is one page of commits.
248+message ListCommitsResponse {
249+ // Commits are the commits of this page, newest first.
250+ repeated Commit commits = 1;
251+ // NextPageToken is passed as page_token to get the next page. Empty when
252+ // there is no next page.
253+ string next_page_token = 2;
254+}
255+
256+// GetCommitRequest selects a commit.
257+message GetCommitRequest {
258+ // Repo is the repository name.
259+ string repo = 1;
260+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
261+ string revision = 2;
262+}
263+
264+// GetCommitResponse holds a commit, its statistics and its diff.
265+message GetCommitResponse {
266+ // Commit is the commit metadata.
267+ Commit commit = 1;
268+ // Stats are the totals over all the changed files, including files that the
269+ // diff omits or truncates.
270+ DiffStats stats = 2;
271+ // Diff is the structured diff against the first parent, or against the empty
272+ // tree for a root commit. For a merge commit this is the change relative to
273+ // the first parent.
274+ Diff diff = 3;
275+}
276+
277+// DiffStats are the totals of a diff.
278+message DiffStats {
279+ // FilesChanged is the number of changed files.
280+ int32 files_changed = 1;
281+ // Additions is the number of added lines. Binary files count for 0.
282+ int32 additions = 2;
283+ // Deletions is the number of deleted lines. Binary files count for 0.
284+ int32 deletions = 3;
285+}
286+
287+// Diff is the structured difference introduced by a commit.
288+//
289+// The server limits its size: at most 300 files, at most 2,000 lines in one
290+// file and at most 20,000 lines in total (hunk lines, context included). These
291+// numbers are server behaviour and may change; clients must rely on the
292+// truncated flags, not on the numbers.
293+message Diff {
294+ // Files are the changed files, ordered by path. Files past the file limit are
295+ // omitted.
296+ repeated FileDiff files = 1;
297+ // Truncated is true when the diff is incomplete: files were omitted, or at
298+ // least one listed file has truncated set. DiffStats still count everything.
299+ bool truncated = 2;
300+}
301+
302+// FileDiff is the change of one file.
303+message FileDiff {
304+ // OldPath is the path before the commit. Empty for an added file.
305+ string old_path = 1;
306+ // NewPath is the path after the commit. Empty for a deleted file.
307+ string new_path = 2;
308+ // Status tells what happened to the file.
309+ FileStatus status = 3;
310+ // OldMode is the Git file mode before the commit, or 0 for an added file.
311+ uint32 old_mode = 4;
312+ // NewMode is the Git file mode after the commit, or 0 for a deleted file.
313+ uint32 new_mode = 5;
314+ // OldId is the blob id before the commit. Empty for an added file.
315+ string old_id = 6;
316+ // NewId is the blob id after the commit. Empty for a deleted file.
317+ string new_id = 7;
318+ // Binary is true if Git treats the file as binary (numstat reports "-"). A
319+ // binary file has no hunks and additions and deletions are 0.
320+ bool binary = 8;
321+ // Additions is the number of added lines.
322+ int32 additions = 9;
323+ // Deletions is the number of deleted lines.
324+ int32 deletions = 10;
325+ // Similarity is the percentage (0-100) of unchanged content for a renamed or
326+ // copied file, and 0 otherwise.
327+ int32 similarity = 11;
328+ // Truncated is true when the file exceeded a diff limit: hunks is then empty
329+ // although the file changed. Additions and deletions remain accurate.
330+ bool truncated = 12;
331+ // Hunks are the changed regions, in file order. Empty for a binary file, a
332+ // truncated file, a pure rename and a mode-only change.
333+ repeated Hunk hunks = 13;
334+}
335+
336+// Hunk is a contiguous changed region with its context.
337+message Hunk {
338+ // OldStart is the 1-based first line of the region in the old file. 0 when
339+ // old_lines is 0 and the file was added.
340+ int32 old_start = 1;
341+ // OldLines is the number of old-side lines in the hunk.
342+ int32 old_lines = 2;
343+ // NewStart is the 1-based first line of the region in the new file. 0 when
344+ // new_lines is 0 and the file was deleted.
345+ int32 new_start = 3;
346+ // NewLines is the number of new-side lines in the hunk.
347+ int32 new_lines = 4;
348+ // Header is the text after the second "@@" of the hunk header, usually the
349+ // enclosing function. It may be empty.
350+ string header = 5;
351+ // Lines are the lines of the hunk, in order.
352+ repeated Line lines = 6;
353+}
354+
355+// Line is one line of a hunk.
356+message Line {
357+ // Kind tells which side the line belongs to.
358+ LineKind kind = 1;
359+ // OldNumber is the 1-based line number on the old side. 0 for an addition.
360+ int32 old_number = 2;
361+ // NewNumber is the 1-based line number on the new side. 0 for a deletion.
362+ int32 new_number = 3;
363+ // Text is the content without the line terminator. Bytes that are not valid
364+ // UTF-8 are replaced by the replacement character.
365+ string text = 4;
366+ // NoNewlineAtEof is true when this is the last line of its side and the file
367+ // does not end with a line break there.
368+ bool no_newline_at_eof = 5;
369+}
370+
371+// ResolveRevisionRequest names a revision.
372+message ResolveRevisionRequest {
373+ // Repo is the repository name.
374+ string repo = 1;
375+ // Revision is a branch, a tag or a commit id. Empty means HEAD.
376+ string revision = 2;
377+}
378+
379+// ResolveRevisionResponse holds the resolved commit.
380+message ResolveRevisionResponse {
381+ // CommitId is the full id of the commit the revision designates, after
382+ // following annotated tags.
383+ string commit_id = 1;
384+ // Ref is the full name of the ref the revision matched, for example
385+ // "refs/heads/main". Empty when the revision was a commit id or for HEAD
386+ // when it is resolved by default.
387+ string ref = 2;
388+}
A proto/ermite/repo.proto +145 -0
@@ -0,0 +1,145 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/field_mask.proto";
8+import "google/protobuf/timestamp.proto";
9+
10+// Visibility says who may read a repository.
11+enum Visibility {
12+ // Not set. In requests, the server applies its default (private on create,
13+ // unchanged on update). Never returned by the server.
14+ VISIBILITY_UNSPECIFIED = 0;
15+ // Anyone, including anonymous callers, may read the repository.
16+ VISIBILITY_PUBLIC = 1;
17+ // Only callers holding the repo:read scope on the repository may read it.
18+ // Everyone else gets not_found, never permission_denied.
19+ VISIBILITY_PRIVATE = 2;
20+}
21+
22+// Repo is the metadata of a repository. Git-owned state (refs, trees, history)
23+// is read through GitService.
24+message Repo {
25+ // Name is the unique, lowercase repository name: 1-100 characters from
26+ // [a-z0-9._-], without a ".git" suffix. It is also the URL path: /<name>.
27+ string name = 1;
28+ // Description is a free one-line description. It may be empty.
29+ string description = 2;
30+ // Visibility is who may read the repository.
31+ Visibility visibility = 3;
32+ // DefaultBranch is the short name of the branch HEAD points to, for example
33+ // "main". It is set even when the branch does not exist yet (empty
34+ // repository).
35+ string default_branch = 4;
36+ // CreatedAt is when the repository was created.
37+ google.protobuf.Timestamp created_at = 5;
38+ // PushedAt is the time of the last push. It is unset until the first push.
39+ google.protobuf.Timestamp pushed_at = 6;
40+}
41+
42+// RepoService manages repositories and their metadata.
43+//
44+// Anonymous callers see public repositories only. A private repository that the
45+// caller cannot read is reported as not_found.
46+service RepoService {
47+ // ListRepos lists the repositories the caller may see, ordered by name.
48+ rpc ListRepos(ListReposRequest) returns (ListReposResponse);
49+ // GetRepo returns one repository. Fails with not_found if it does not exist
50+ // or is private and not readable by the caller.
51+ rpc GetRepo(GetRepoRequest) returns (GetRepoResponse);
52+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
53+ // with already_exists if the name is taken and invalid_argument if the name
54+ // is not valid.
55+ rpc CreateRepo(CreateRepoRequest) returns (CreateRepoResponse);
56+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
57+ // scope.
58+ rpc UpdateRepo(UpdateRepoRequest) returns (UpdateRepoResponse);
59+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
60+ // moves the data aside rather than destroying it; there is no undelete RPC.
61+ rpc DeleteRepo(DeleteRepoRequest) returns (DeleteRepoResponse);
62+}
63+
64+// ListReposRequest selects a page of repositories.
65+message ListReposRequest {
66+ // PageSize is the maximum number of repositories to return. 0 means the
67+ // server default; values above the server maximum are lowered to it.
68+ int32 page_size = 1;
69+ // PageToken is the next_page_token of a previous response, to get the page
70+ // after it. Empty for the first page.
71+ string page_token = 2;
72+}
73+
74+// ListReposResponse is one page of repositories.
75+message ListReposResponse {
76+ // Repos are the repositories of this page, ordered by name.
77+ repeated Repo repos = 1;
78+ // NextPageToken is passed as page_token to get the next page. Empty when
79+ // there is no next page.
80+ string next_page_token = 2;
81+}
82+
83+// GetRepoRequest names the repository to read.
84+message GetRepoRequest {
85+ // Repo is the repository name.
86+ string repo = 1;
87+}
88+
89+// GetRepoResponse holds the repository.
90+message GetRepoResponse {
91+ // Repo is the repository metadata.
92+ Repo repo = 1;
93+}
94+
95+// CreateRepoRequest describes the repository to create.
96+message CreateRepoRequest {
97+ // Name is the name of the new repository. Names are lowercase; an uppercase
98+ // name is rejected with invalid_argument.
99+ string name = 1;
100+ // Description is an optional one-line description.
101+ string description = 2;
102+ // Visibility of the new repository. VISIBILITY_UNSPECIFIED means private.
103+ Visibility visibility = 3;
104+}
105+
106+// CreateRepoResponse holds the new repository.
107+message CreateRepoResponse {
108+ // Repo is the created repository.
109+ Repo repo = 1;
110+}
111+
112+// UpdateRepoRequest changes some fields of a repository.
113+message UpdateRepoRequest {
114+ // Repo is the name of the repository to change. Repositories cannot be
115+ // renamed.
116+ string repo = 1;
117+ // Description is the new description. Used only if update_mask contains
118+ // "description"; an empty value then clears it.
119+ string description = 2;
120+ // Visibility is the new visibility. Used only if update_mask contains
121+ // "visibility"; it must not be VISIBILITY_UNSPECIFIED then.
122+ Visibility visibility = 3;
123+ // DefaultBranch is the short name of the new default branch. Used only if
124+ // update_mask contains "default_branch". The branch must exist, otherwise
125+ // the call fails with failed_precondition.
126+ string default_branch = 4;
127+ // UpdateMask lists the fields to change: "description", "visibility" and/or
128+ // "default_branch". It must not be empty. Other paths are invalid_argument.
129+ google.protobuf.FieldMask update_mask = 5;
130+}
131+
132+// UpdateRepoResponse holds the repository after the update.
133+message UpdateRepoResponse {
134+ // Repo is the updated repository.
135+ Repo repo = 1;
136+}
137+
138+// DeleteRepoRequest names the repository to delete.
139+message DeleteRepoRequest {
140+ // Repo is the repository name.
141+ string repo = 1;
142+}
143+
144+// DeleteRepoResponse is empty.
145+message DeleteRepoResponse {}
@@ -0,0 +1,145 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/field_mask.proto";
8+import "google/protobuf/timestamp.proto";
9+
10+// Visibility says who may read a repository.
11+enum Visibility {
12+ // Not set. In requests, the server applies its default (private on create,
13+ // unchanged on update). Never returned by the server.
14+ VISIBILITY_UNSPECIFIED = 0;
15+ // Anyone, including anonymous callers, may read the repository.
16+ VISIBILITY_PUBLIC = 1;
17+ // Only callers holding the repo:read scope on the repository may read it.
18+ // Everyone else gets not_found, never permission_denied.
19+ VISIBILITY_PRIVATE = 2;
20+}
21+
22+// Repo is the metadata of a repository. Git-owned state (refs, trees, history)
23+// is read through GitService.
24+message Repo {
25+ // Name is the unique, lowercase repository name: 1-100 characters from
26+ // [a-z0-9._-], without a ".git" suffix. It is also the URL path: /<name>.
27+ string name = 1;
28+ // Description is a free one-line description. It may be empty.
29+ string description = 2;
30+ // Visibility is who may read the repository.
31+ Visibility visibility = 3;
32+ // DefaultBranch is the short name of the branch HEAD points to, for example
33+ // "main". It is set even when the branch does not exist yet (empty
34+ // repository).
35+ string default_branch = 4;
36+ // CreatedAt is when the repository was created.
37+ google.protobuf.Timestamp created_at = 5;
38+ // PushedAt is the time of the last push. It is unset until the first push.
39+ google.protobuf.Timestamp pushed_at = 6;
40+}
41+
42+// RepoService manages repositories and their metadata.
43+//
44+// Anonymous callers see public repositories only. A private repository that the
45+// caller cannot read is reported as not_found.
46+service RepoService {
47+ // ListRepos lists the repositories the caller may see, ordered by name.
48+ rpc ListRepos(ListReposRequest) returns (ListReposResponse);
49+ // GetRepo returns one repository. Fails with not_found if it does not exist
50+ // or is private and not readable by the caller.
51+ rpc GetRepo(GetRepoRequest) returns (GetRepoResponse);
52+ // CreateRepo creates an empty repository. Needs the repo:write scope. Fails
53+ // with already_exists if the name is taken and invalid_argument if the name
54+ // is not valid.
55+ rpc CreateRepo(CreateRepoRequest) returns (CreateRepoResponse);
56+ // UpdateRepo changes the fields named in update_mask. Needs the repo:admin
57+ // scope.
58+ rpc UpdateRepo(UpdateRepoRequest) returns (UpdateRepoResponse);
59+ // DeleteRepo deletes a repository. Needs the repo:admin scope. The server
60+ // moves the data aside rather than destroying it; there is no undelete RPC.
61+ rpc DeleteRepo(DeleteRepoRequest) returns (DeleteRepoResponse);
62+}
63+
64+// ListReposRequest selects a page of repositories.
65+message ListReposRequest {
66+ // PageSize is the maximum number of repositories to return. 0 means the
67+ // server default; values above the server maximum are lowered to it.
68+ int32 page_size = 1;
69+ // PageToken is the next_page_token of a previous response, to get the page
70+ // after it. Empty for the first page.
71+ string page_token = 2;
72+}
73+
74+// ListReposResponse is one page of repositories.
75+message ListReposResponse {
76+ // Repos are the repositories of this page, ordered by name.
77+ repeated Repo repos = 1;
78+ // NextPageToken is passed as page_token to get the next page. Empty when
79+ // there is no next page.
80+ string next_page_token = 2;
81+}
82+
83+// GetRepoRequest names the repository to read.
84+message GetRepoRequest {
85+ // Repo is the repository name.
86+ string repo = 1;
87+}
88+
89+// GetRepoResponse holds the repository.
90+message GetRepoResponse {
91+ // Repo is the repository metadata.
92+ Repo repo = 1;
93+}
94+
95+// CreateRepoRequest describes the repository to create.
96+message CreateRepoRequest {
97+ // Name is the name of the new repository. Names are lowercase; an uppercase
98+ // name is rejected with invalid_argument.
99+ string name = 1;
100+ // Description is an optional one-line description.
101+ string description = 2;
102+ // Visibility of the new repository. VISIBILITY_UNSPECIFIED means private.
103+ Visibility visibility = 3;
104+}
105+
106+// CreateRepoResponse holds the new repository.
107+message CreateRepoResponse {
108+ // Repo is the created repository.
109+ Repo repo = 1;
110+}
111+
112+// UpdateRepoRequest changes some fields of a repository.
113+message UpdateRepoRequest {
114+ // Repo is the name of the repository to change. Repositories cannot be
115+ // renamed.
116+ string repo = 1;
117+ // Description is the new description. Used only if update_mask contains
118+ // "description"; an empty value then clears it.
119+ string description = 2;
120+ // Visibility is the new visibility. Used only if update_mask contains
121+ // "visibility"; it must not be VISIBILITY_UNSPECIFIED then.
122+ Visibility visibility = 3;
123+ // DefaultBranch is the short name of the new default branch. Used only if
124+ // update_mask contains "default_branch". The branch must exist, otherwise
125+ // the call fails with failed_precondition.
126+ string default_branch = 4;
127+ // UpdateMask lists the fields to change: "description", "visibility" and/or
128+ // "default_branch". It must not be empty. Other paths are invalid_argument.
129+ google.protobuf.FieldMask update_mask = 5;
130+}
131+
132+// UpdateRepoResponse holds the repository after the update.
133+message UpdateRepoResponse {
134+ // Repo is the updated repository.
135+ Repo repo = 1;
136+}
137+
138+// DeleteRepoRequest names the repository to delete.
139+message DeleteRepoRequest {
140+ // Repo is the repository name.
141+ string repo = 1;
142+}
143+
144+// DeleteRepoResponse is empty.
145+message DeleteRepoResponse {}
A proto/ermite/server.proto +30 -0
@@ -0,0 +1,30 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+// ServerService describes the server itself.
8+service ServerService {
9+ // GetVersion returns the server version and the optional capabilities of the
10+ // contract it implements. It needs no authentication, so a client can call
11+ // it first to check compatibility.
12+ rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
13+}
14+
15+// GetVersionRequest is empty.
16+message GetVersionRequest {}
17+
18+// GetVersionResponse describes the running server.
19+message GetVersionResponse {
20+ // Version is the server release, for example "v0.4.0", or "devel" for an
21+ // untagged build. Informational: clients must not compare it to decide what
22+ // is supported, they use features instead.
23+ string version = 1;
24+ // Features lists identifiers of the optional capabilities of the contract
25+ // that this server implements, for example "repo.update" or
26+ // "events.resume". A client that needs a capability missing from this list
27+ // should warn instead of failing on an unimplemented RPC or ignored field.
28+ // Identifiers are lowercase, dot-separated and never reused.
29+ repeated string features = 2;
30+}
@@ -0,0 +1,30 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+// ServerService describes the server itself.
8+service ServerService {
9+ // GetVersion returns the server version and the optional capabilities of the
10+ // contract it implements. It needs no authentication, so a client can call
11+ // it first to check compatibility.
12+ rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
13+}
14+
15+// GetVersionRequest is empty.
16+message GetVersionRequest {}
17+
18+// GetVersionResponse describes the running server.
19+message GetVersionResponse {
20+ // Version is the server release, for example "v0.4.0", or "devel" for an
21+ // untagged build. Informational: clients must not compare it to decide what
22+ // is supported, they use features instead.
23+ string version = 1;
24+ // Features lists identifiers of the optional capabilities of the contract
25+ // that this server implements, for example "repo.update" or
26+ // "events.resume". A client that needs a capability missing from this list
27+ // should warn instead of failing on an unimplemented RPC or ignored field.
28+ // Identifiers are lowercase, dot-separated and never reused.
29+ repeated string features = 2;
30+}
A proto/ermite/token.proto +132 -0
@@ -0,0 +1,132 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/timestamp.proto";
8+
9+// Scope is a permission carried by a token. The API knows scopes only; any
10+// grouping into presets is a client concern.
11+enum Scope {
12+ // Not set. Rejected in requests, never returned by the server.
13+ SCOPE_UNSPECIFIED = 0;
14+ // SCOPE_REPO_READ allows reading private repositories (public ones need no
15+ // token). Wire name: repo:read.
16+ SCOPE_REPO_READ = 1;
17+ // SCOPE_REPO_WRITE allows pushing and creating repositories. Wire name:
18+ // repo:write.
19+ SCOPE_REPO_WRITE = 2;
20+ // SCOPE_REPO_ADMIN allows deleting a repository and changing its visibility,
21+ // description or default branch. Wire name: repo:admin.
22+ SCOPE_REPO_ADMIN = 3;
23+ // SCOPE_MR_WRITE allows creating, commenting on and closing merge requests.
24+ // Wire name: mr:write.
25+ SCOPE_MR_WRITE = 4;
26+ // SCOPE_MR_MERGE allows merging merge requests. Wire name: mr:merge.
27+ SCOPE_MR_MERGE = 5;
28+ // SCOPE_CI_WRITE allows re-running or cancelling CI runs. Wire name:
29+ // ci:write.
30+ SCOPE_CI_WRITE = 6;
31+ // SCOPE_SECRETS_WRITE allows setting and deleting secrets and variables.
32+ // Wire name: secrets:write.
33+ SCOPE_SECRETS_WRITE = 7;
34+ // SCOPE_RUNNER_REGISTER allows registering a CI runner. Wire name:
35+ // runner:register.
36+ SCOPE_RUNNER_REGISTER = 8;
37+ // SCOPE_TOKEN_ADMIN allows creating, listing and revoking tokens. Wire name:
38+ // token:admin.
39+ SCOPE_TOKEN_ADMIN = 9;
40+}
41+
42+// Token describes a stored token. It never contains the secret nor its hash.
43+message Token {
44+ // Id identifies the token in ListTokens and RevokeToken. It is not the
45+ // secret and cannot be used to authenticate.
46+ string id = 1;
47+ // Label is a human-readable name chosen at creation.
48+ string label = 2;
49+ // Scopes are the permissions of the token. Never empty.
50+ repeated Scope scopes = 3;
51+ // Repos restricts the token to these repository names. Empty means every
52+ // repository.
53+ repeated string repos = 4;
54+ // ExpiresAt is when the token stops working. Unset means it never expires.
55+ google.protobuf.Timestamp expires_at = 5;
56+ // CreatedAt is when the token was created.
57+ google.protobuf.Timestamp created_at = 6;
58+ // LastUsedAt is when the token last authenticated a request. Unset if never
59+ // used. It may lag behind the real time by a short delay.
60+ google.protobuf.Timestamp last_used_at = 7;
61+}
62+
63+// TokenService manages stored tokens. Every RPC needs the token:admin scope.
64+//
65+// A token can only create tokens that are within its own limits: scopes that
66+// it holds, repositories that it may access and an expiry no later than its
67+// own. The root token (ERMITE_ADMIN_TOKEN) is not a stored token and is never
68+// listed.
69+service TokenService {
70+ // CreateToken creates a token and returns its secret. The secret is shown
71+ // only in this response and cannot be retrieved later. Fails with
72+ // permission_denied when the new token would exceed the caller's limits and
73+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
74+ rpc CreateToken(CreateTokenRequest) returns (CreateTokenResponse);
75+ // ListTokens lists stored tokens, newest first.
76+ rpc ListTokens(ListTokensRequest) returns (ListTokensResponse);
77+ // RevokeToken deletes a token; it stops working immediately. Fails with
78+ // not_found if the id is unknown.
79+ rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse);
80+}
81+
82+// CreateTokenRequest describes the token to create.
83+message CreateTokenRequest {
84+ // Label is a human-readable name, for example "laptop". Not required to be
85+ // unique.
86+ string label = 1;
87+ // Scopes are the permissions to grant. At least one is required.
88+ repeated Scope scopes = 2;
89+ // Repos restricts the token to these repository names. Empty means every
90+ // repository.
91+ repeated string repos = 3;
92+ // ExpiresAt is when the token stops working. Unset means no expiry. It must
93+ // be in the future.
94+ google.protobuf.Timestamp expires_at = 4;
95+}
96+
97+// CreateTokenResponse holds the new token and its secret.
98+message CreateTokenResponse {
99+ // Token describes the created token.
100+ Token token = 1;
101+ // Secret is the bearer secret to present as "Authorization: Bearer <secret>".
102+ // It is returned once and never stored in clear text by the server.
103+ string secret = 2;
104+}
105+
106+// ListTokensRequest selects a page of tokens.
107+message ListTokensRequest {
108+ // PageSize is the maximum number of tokens to return. 0 means the server
109+ // default; values above the server maximum are lowered to it.
110+ int32 page_size = 1;
111+ // PageToken is the next_page_token of a previous response. Empty for the
112+ // first page.
113+ string page_token = 2;
114+}
115+
116+// ListTokensResponse is one page of tokens.
117+message ListTokensResponse {
118+ // Tokens are the tokens of this page, newest first.
119+ repeated Token tokens = 1;
120+ // NextPageToken is passed as page_token to get the next page. Empty when
121+ // there is no next page.
122+ string next_page_token = 2;
123+}
124+
125+// RevokeTokenRequest names the token to revoke.
126+message RevokeTokenRequest {
127+ // Id is the Token.id to revoke.
128+ string id = 1;
129+}
130+
131+// RevokeTokenResponse is empty.
132+message RevokeTokenResponse {}
@@ -0,0 +1,132 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/timestamp.proto";
8+
9+// Scope is a permission carried by a token. The API knows scopes only; any
10+// grouping into presets is a client concern.
11+enum Scope {
12+ // Not set. Rejected in requests, never returned by the server.
13+ SCOPE_UNSPECIFIED = 0;
14+ // SCOPE_REPO_READ allows reading private repositories (public ones need no
15+ // token). Wire name: repo:read.
16+ SCOPE_REPO_READ = 1;
17+ // SCOPE_REPO_WRITE allows pushing and creating repositories. Wire name:
18+ // repo:write.
19+ SCOPE_REPO_WRITE = 2;
20+ // SCOPE_REPO_ADMIN allows deleting a repository and changing its visibility,
21+ // description or default branch. Wire name: repo:admin.
22+ SCOPE_REPO_ADMIN = 3;
23+ // SCOPE_MR_WRITE allows creating, commenting on and closing merge requests.
24+ // Wire name: mr:write.
25+ SCOPE_MR_WRITE = 4;
26+ // SCOPE_MR_MERGE allows merging merge requests. Wire name: mr:merge.
27+ SCOPE_MR_MERGE = 5;
28+ // SCOPE_CI_WRITE allows re-running or cancelling CI runs. Wire name:
29+ // ci:write.
30+ SCOPE_CI_WRITE = 6;
31+ // SCOPE_SECRETS_WRITE allows setting and deleting secrets and variables.
32+ // Wire name: secrets:write.
33+ SCOPE_SECRETS_WRITE = 7;
34+ // SCOPE_RUNNER_REGISTER allows registering a CI runner. Wire name:
35+ // runner:register.
36+ SCOPE_RUNNER_REGISTER = 8;
37+ // SCOPE_TOKEN_ADMIN allows creating, listing and revoking tokens. Wire name:
38+ // token:admin.
39+ SCOPE_TOKEN_ADMIN = 9;
40+}
41+
42+// Token describes a stored token. It never contains the secret nor its hash.
43+message Token {
44+ // Id identifies the token in ListTokens and RevokeToken. It is not the
45+ // secret and cannot be used to authenticate.
46+ string id = 1;
47+ // Label is a human-readable name chosen at creation.
48+ string label = 2;
49+ // Scopes are the permissions of the token. Never empty.
50+ repeated Scope scopes = 3;
51+ // Repos restricts the token to these repository names. Empty means every
52+ // repository.
53+ repeated string repos = 4;
54+ // ExpiresAt is when the token stops working. Unset means it never expires.
55+ google.protobuf.Timestamp expires_at = 5;
56+ // CreatedAt is when the token was created.
57+ google.protobuf.Timestamp created_at = 6;
58+ // LastUsedAt is when the token last authenticated a request. Unset if never
59+ // used. It may lag behind the real time by a short delay.
60+ google.protobuf.Timestamp last_used_at = 7;
61+}
62+
63+// TokenService manages stored tokens. Every RPC needs the token:admin scope.
64+//
65+// A token can only create tokens that are within its own limits: scopes that
66+// it holds, repositories that it may access and an expiry no later than its
67+// own. The root token (ERMITE_ADMIN_TOKEN) is not a stored token and is never
68+// listed.
69+service TokenService {
70+ // CreateToken creates a token and returns its secret. The secret is shown
71+ // only in this response and cannot be retrieved later. Fails with
72+ // permission_denied when the new token would exceed the caller's limits and
73+ // with invalid_argument when scopes is empty or contains SCOPE_UNSPECIFIED.
74+ rpc CreateToken(CreateTokenRequest) returns (CreateTokenResponse);
75+ // ListTokens lists stored tokens, newest first.
76+ rpc ListTokens(ListTokensRequest) returns (ListTokensResponse);
77+ // RevokeToken deletes a token; it stops working immediately. Fails with
78+ // not_found if the id is unknown.
79+ rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse);
80+}
81+
82+// CreateTokenRequest describes the token to create.
83+message CreateTokenRequest {
84+ // Label is a human-readable name, for example "laptop". Not required to be
85+ // unique.
86+ string label = 1;
87+ // Scopes are the permissions to grant. At least one is required.
88+ repeated Scope scopes = 2;
89+ // Repos restricts the token to these repository names. Empty means every
90+ // repository.
91+ repeated string repos = 3;
92+ // ExpiresAt is when the token stops working. Unset means no expiry. It must
93+ // be in the future.
94+ google.protobuf.Timestamp expires_at = 4;
95+}
96+
97+// CreateTokenResponse holds the new token and its secret.
98+message CreateTokenResponse {
99+ // Token describes the created token.
100+ Token token = 1;
101+ // Secret is the bearer secret to present as "Authorization: Bearer <secret>".
102+ // It is returned once and never stored in clear text by the server.
103+ string secret = 2;
104+}
105+
106+// ListTokensRequest selects a page of tokens.
107+message ListTokensRequest {
108+ // PageSize is the maximum number of tokens to return. 0 means the server
109+ // default; values above the server maximum are lowered to it.
110+ int32 page_size = 1;
111+ // PageToken is the next_page_token of a previous response. Empty for the
112+ // first page.
113+ string page_token = 2;
114+}
115+
116+// ListTokensResponse is one page of tokens.
117+message ListTokensResponse {
118+ // Tokens are the tokens of this page, newest first.
119+ repeated Token tokens = 1;
120+ // NextPageToken is passed as page_token to get the next page. Empty when
121+ // there is no next page.
122+ string next_page_token = 2;
123+}
124+
125+// RevokeTokenRequest names the token to revoke.
126+message RevokeTokenRequest {
127+ // Id is the Token.id to revoke.
128+ string id = 1;
129+}
130+
131+// RevokeTokenResponse is empty.
132+message RevokeTokenResponse {}
A proto/ermite/types.proto +37 -0
@@ -0,0 +1,37 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/timestamp.proto";
8+
9+// Signature identifies who did something in Git and when: the author or the
10+// committer of a commit.
11+message Signature {
12+ // Name is the person's name as recorded in the commit.
13+ string name = 1;
14+ // Email is the person's email address as recorded in the commit.
15+ string email = 2;
16+ // Time is when the action happened. The time zone offset of the commit is
17+ // not kept.
18+ google.protobuf.Timestamp time = 3;
19+}
20+
21+// Commit is the metadata of one Git commit.
22+message Commit {
23+ // Id is the full object id (40 lowercase hexadecimal characters for SHA-1).
24+ string id = 1;
25+ // ParentIds are the ids of the parent commits, first parent first. Empty for
26+ // a root commit.
27+ repeated string parent_ids = 2;
28+ // Author is who wrote the change.
29+ Signature author = 3;
30+ // Committer is who recorded the commit.
31+ Signature committer = 4;
32+ // Summary is the first line of the message, without the line break.
33+ string summary = 5;
34+ // Message is the full commit message, including the summary. Text that is
35+ // not valid UTF-8 is converted with the replacement character.
36+ string message = 6;
37+}
@@ -0,0 +1,37 @@
1+// SPDX-License-Identifier: MIT
2+
3+syntax = "proto3";
4+
5+package ermite;
6+
7+import "google/protobuf/timestamp.proto";
8+
9+// Signature identifies who did something in Git and when: the author or the
10+// committer of a commit.
11+message Signature {
12+ // Name is the person's name as recorded in the commit.
13+ string name = 1;
14+ // Email is the person's email address as recorded in the commit.
15+ string email = 2;
16+ // Time is when the action happened. The time zone offset of the commit is
17+ // not kept.
18+ google.protobuf.Timestamp time = 3;
19+}
20+
21+// Commit is the metadata of one Git commit.
22+message Commit {
23+ // Id is the full object id (40 lowercase hexadecimal characters for SHA-1).
24+ string id = 1;
25+ // ParentIds are the ids of the parent commits, first parent first. Empty for
26+ // a root commit.
27+ repeated string parent_ids = 2;
28+ // Author is who wrote the change.
29+ Signature author = 3;
30+ // Committer is who recorded the commit.
31+ Signature committer = 4;
32+ // Summary is the first line of the message, without the line break.
33+ string summary = 5;
34+ // Message is the full commit message, including the summary. Text that is
35+ // not valid UTF-8 is converted with the replacement character.
36+ string message = 6;
37+}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 18

↑↓ moveenter openesc close