1syntax = "proto3";
2package zed.messages;
3
4import "worktree.proto";
5import "buffer.proto";
6
7message GitBranchesResponse {
8 repeated Branch branches = 1;
9}
10
11message UpdateDiffBases {
12 uint64 project_id = 1;
13 uint64 buffer_id = 2;
14
15 enum Mode {
16 // No collaborator is using the unstaged diff.
17 HEAD_ONLY = 0;
18 // No collaborator is using the diff from HEAD.
19 INDEX_ONLY = 1;
20 // Both the unstaged and uncommitted diffs are demanded,
21 // and the contents of the index and HEAD are the same for this path.
22 INDEX_MATCHES_HEAD = 2;
23 // Both the unstaged and uncommitted diffs are demanded,
24 // and the contents of the index and HEAD differ for this path,
25 // where None means the path doesn't exist in that state of the repo.
26 INDEX_AND_HEAD = 3;
27 }
28
29 optional string staged_text = 3;
30 optional string committed_text = 4;
31 Mode mode = 5;
32}
33
34message OpenUnstagedDiff {
35 uint64 project_id = 1;
36 uint64 buffer_id = 2;
37}
38
39message OpenUnstagedDiffResponse {
40 optional string staged_text = 1;
41}
42
43message OpenUncommittedDiff {
44 uint64 project_id = 1;
45 uint64 buffer_id = 2;
46}
47
48message OpenUncommittedDiffResponse {
49 enum Mode {
50 INDEX_MATCHES_HEAD = 0;
51 INDEX_AND_HEAD = 1;
52 }
53 optional string staged_text = 1;
54 optional string committed_text = 2;
55 Mode mode = 3;
56}
57
58message SetIndexText {
59 uint64 project_id = 1;
60 reserved 2;
61 uint64 repository_id = 3;
62 string path = 4;
63 optional string text = 5;
64}
65
66message GetPermalinkToLine {
67 uint64 project_id = 1;
68 uint64 buffer_id = 2;
69 Range selection = 3;
70}
71
72message GetPermalinkToLineResponse {
73 string permalink = 1;
74}
75
76message Branch {
77 bool is_head = 1;
78 string name = 2;
79 optional uint64 unix_timestamp = 3;
80 optional GitUpstream upstream = 4;
81 optional CommitSummary most_recent_commit = 5;
82}
83
84message GitUpstream {
85 string ref_name = 1;
86 optional UpstreamTracking tracking = 2;
87}
88
89message UpstreamTracking {
90 uint64 ahead = 1;
91 uint64 behind = 2;
92}
93
94message CommitSummary {
95 string sha = 1;
96 string subject = 2;
97 int64 commit_timestamp = 3;
98}
99
100message GitBranches {
101 uint64 project_id = 1;
102 ProjectPath repository = 2;
103}
104
105
106message UpdateGitBranch {
107 uint64 project_id = 1;
108 string branch_name = 2;
109 ProjectPath repository = 3;
110}
111
112message UpdateRepository {
113 uint64 project_id = 1;
114 uint64 id = 2;
115 string abs_path = 3;
116 repeated uint64 entry_ids = 4;
117 optional Branch branch_summary = 5;
118 repeated StatusEntry updated_statuses = 6;
119 repeated string removed_statuses = 7;
120 repeated string current_merge_conflicts = 8;
121 uint64 scan_id = 9;
122 bool is_last_update = 10;
123}
124
125message RemoveRepository {
126 uint64 project_id = 1;
127 uint64 id = 2;
128}
129
130enum GitStatus {
131 Added = 0;
132 Modified = 1;
133 Conflict = 2;
134 Deleted = 3;
135 Updated = 4;
136 TypeChanged = 5;
137 Renamed = 6;
138 Copied = 7;
139 Unmodified = 8;
140}
141
142message GitFileStatus {
143 oneof variant {
144 Untracked untracked = 1;
145 Ignored ignored = 2;
146 Unmerged unmerged = 3;
147 Tracked tracked = 4;
148 }
149
150 message Untracked {}
151 message Ignored {}
152 message Unmerged {
153 GitStatus first_head = 1;
154 GitStatus second_head = 2;
155 }
156 message Tracked {
157 GitStatus index_status = 1;
158 GitStatus worktree_status = 2;
159 }
160}
161
162message GitGetBranches {
163 uint64 project_id = 1;
164 reserved 2;
165 uint64 repository_id = 3;
166}
167
168message GitCreateBranch {
169 uint64 project_id = 1;
170 reserved 2;
171 uint64 repository_id = 3;
172 string branch_name = 4;
173}
174
175message GitChangeBranch {
176 uint64 project_id = 1;
177 reserved 2;
178 uint64 repository_id = 3;
179 string branch_name = 4;
180}
181
182message GitDiff {
183 uint64 project_id = 1;
184 reserved 2;
185 uint64 repository_id = 3;
186 DiffType diff_type = 4;
187
188 enum DiffType {
189 HEAD_TO_WORKTREE = 0;
190 HEAD_TO_INDEX = 1;
191 }
192}
193
194message GitDiffResponse {
195 string diff = 1;
196}
197
198message GitInit {
199 uint64 project_id = 1;
200 string abs_path = 2;
201 string fallback_branch_name = 3;
202}
203
204message CheckForPushedCommits {
205 uint64 project_id = 1;
206 reserved 2;
207 uint64 repository_id = 3;
208}
209
210message CheckForPushedCommitsResponse {
211 repeated string pushed_to = 1;
212}
213
214message GitShow {
215 uint64 project_id = 1;
216 reserved 2;
217 uint64 repository_id = 3;
218 string commit = 4;
219}
220
221message GitCommitDetails {
222 string sha = 1;
223 string message = 2;
224 int64 commit_timestamp = 3;
225 string author_email = 4;
226 string author_name = 5;
227}
228
229message LoadCommitDiff {
230 uint64 project_id = 1;
231 reserved 2;
232 uint64 repository_id = 3;
233 string commit = 4;
234}
235
236message LoadCommitDiffResponse {
237 repeated CommitFile files = 1;
238}
239
240message CommitFile {
241 string path = 1;
242 optional string old_text = 2;
243 optional string new_text = 3;
244}
245
246message GitReset {
247 uint64 project_id = 1;
248 reserved 2;
249 uint64 repository_id = 3;
250 string commit = 4;
251 ResetMode mode = 5;
252 enum ResetMode {
253 SOFT = 0;
254 MIXED = 1;
255 }
256}
257
258message GitCheckoutFiles {
259 uint64 project_id = 1;
260 reserved 2;
261 uint64 repository_id = 3;
262 string commit = 4;
263 repeated string paths = 5;
264}
265
266// Move to `git.proto` once collab's min version is >=0.171.0.
267message StatusEntry {
268 string repo_path = 1;
269 // Can be removed once collab's min version is >=0.171.0.
270 GitStatus simple_status = 2;
271 GitFileStatus status = 3;
272}
273
274message Stage {
275 uint64 project_id = 1;
276 reserved 2;
277 uint64 repository_id = 3;
278 repeated string paths = 4;
279}
280
281message Unstage {
282 uint64 project_id = 1;
283 reserved 2;
284 uint64 repository_id = 3;
285 repeated string paths = 4;
286}
287
288message Commit {
289 uint64 project_id = 1;
290 reserved 2;
291 uint64 repository_id = 3;
292 optional string name = 4;
293 optional string email = 5;
294 string message = 6;
295 optional CommitOptions options = 7;
296
297 message CommitOptions {
298 bool amend = 1;
299 }
300}
301
302message OpenCommitMessageBuffer {
303 uint64 project_id = 1;
304 reserved 2;
305 uint64 repository_id = 3;
306}
307
308message Push {
309 uint64 project_id = 1;
310 reserved 2;
311 uint64 repository_id = 3;
312 string remote_name = 4;
313 string branch_name = 5;
314 optional PushOptions options = 6;
315 uint64 askpass_id = 7;
316
317 enum PushOptions {
318 SET_UPSTREAM = 0;
319 FORCE = 1;
320 }
321}
322
323message Fetch {
324 uint64 project_id = 1;
325 reserved 2;
326 uint64 repository_id = 3;
327 uint64 askpass_id = 4;
328}
329
330message GetRemotes {
331 uint64 project_id = 1;
332 reserved 2;
333 uint64 repository_id = 3;
334 optional string branch_name = 4;
335}
336
337message GetRemotesResponse {
338 repeated Remote remotes = 1;
339
340 message Remote {
341 string name = 1;
342 }
343}
344
345message Pull {
346 uint64 project_id = 1;
347 reserved 2;
348 uint64 repository_id = 3;
349 string remote_name = 4;
350 string branch_name = 5;
351 uint64 askpass_id = 6;
352}
353
354message RemoteMessageResponse {
355 string stdout = 1;
356 string stderr = 2;
357}
358
359message BlameBuffer {
360 uint64 project_id = 1;
361 uint64 buffer_id = 2;
362 repeated VectorClockEntry version = 3;
363}
364
365message BlameEntry {
366 bytes sha = 1;
367
368 uint32 start_line = 2;
369 uint32 end_line = 3;
370 uint32 original_line_number = 4;
371
372 optional string author = 5;
373 optional string author_mail = 6;
374 optional int64 author_time = 7;
375 optional string author_tz = 8;
376
377 optional string committer = 9;
378 optional string committer_mail = 10;
379 optional int64 committer_time = 11;
380 optional string committer_tz = 12;
381
382 optional string summary = 13;
383 optional string previous = 14;
384
385 string filename = 15;
386}
387
388message CommitMessage {
389 bytes oid = 1;
390 string message = 2;
391}
392
393message CommitPermalink {
394 bytes oid = 1;
395 string permalink = 2;
396}
397
398message BlameBufferResponse {
399 message BlameResponse {
400 repeated BlameEntry entries = 1;
401 repeated CommitMessage messages = 2;
402 optional string remote_url = 4;
403 reserved 3;
404 }
405
406 optional BlameResponse blame_response = 5;
407
408 reserved 1 to 4;
409}