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 ref_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 string author_name = 4;
99}
100
101message GitBranches {
102 uint64 project_id = 1;
103 ProjectPath repository = 2;
104}
105
106
107message UpdateGitBranch {
108 uint64 project_id = 1;
109 string branch_name = 2;
110 ProjectPath repository = 3;
111}
112
113message UpdateRepository {
114 uint64 project_id = 1;
115 uint64 id = 2;
116 string abs_path = 3;
117 repeated uint64 entry_ids = 4;
118 optional Branch branch_summary = 5;
119 repeated StatusEntry updated_statuses = 6;
120 repeated string removed_statuses = 7;
121 repeated string current_merge_conflicts = 8;
122 uint64 scan_id = 9;
123 bool is_last_update = 10;
124 optional GitCommitDetails head_commit_details = 11;
125 optional string merge_message = 12;
126 repeated StashEntry stash_entries = 13;
127}
128
129message RemoveRepository {
130 uint64 project_id = 1;
131 uint64 id = 2;
132}
133
134enum GitStatus {
135 Added = 0;
136 Modified = 1;
137 Conflict = 2;
138 Deleted = 3;
139 Updated = 4;
140 TypeChanged = 5;
141 Renamed = 6;
142 Copied = 7;
143 Unmodified = 8;
144}
145
146message GitFileStatus {
147 oneof variant {
148 Untracked untracked = 1;
149 Ignored ignored = 2;
150 Unmerged unmerged = 3;
151 Tracked tracked = 4;
152 }
153
154 message Untracked {}
155 message Ignored {}
156 message Unmerged {
157 GitStatus first_head = 1;
158 GitStatus second_head = 2;
159 }
160 message Tracked {
161 GitStatus index_status = 1;
162 GitStatus worktree_status = 2;
163 }
164}
165
166message GitGetBranches {
167 uint64 project_id = 1;
168 reserved 2;
169 uint64 repository_id = 3;
170}
171
172message GitCreateBranch {
173 uint64 project_id = 1;
174 reserved 2;
175 uint64 repository_id = 3;
176 string branch_name = 4;
177}
178
179message GitChangeBranch {
180 uint64 project_id = 1;
181 reserved 2;
182 uint64 repository_id = 3;
183 string branch_name = 4;
184}
185
186message GitRenameBranch {
187 uint64 project_id = 1;
188 uint64 repository_id = 2;
189 string branch = 3;
190 string new_name = 4;
191}
192
193message GitDiff {
194 uint64 project_id = 1;
195 reserved 2;
196 uint64 repository_id = 3;
197 DiffType diff_type = 4;
198
199 enum DiffType {
200 HEAD_TO_WORKTREE = 0;
201 HEAD_TO_INDEX = 1;
202 }
203}
204
205message GitDiffResponse {
206 string diff = 1;
207}
208
209message GitInit {
210 uint64 project_id = 1;
211 string abs_path = 2;
212 string fallback_branch_name = 3;
213}
214
215message GitClone {
216 uint64 project_id = 1;
217 string abs_path = 2;
218 string remote_repo = 3;
219}
220
221message GitCloneResponse {
222 bool success = 1;
223}
224
225message CheckForPushedCommits {
226 uint64 project_id = 1;
227 reserved 2;
228 uint64 repository_id = 3;
229}
230
231message CheckForPushedCommitsResponse {
232 repeated string pushed_to = 1;
233}
234
235message GitShow {
236 uint64 project_id = 1;
237 reserved 2;
238 uint64 repository_id = 3;
239 string commit = 4;
240}
241
242message GitCommitDetails {
243 string sha = 1;
244 string message = 2;
245 int64 commit_timestamp = 3;
246 string author_email = 4;
247 string author_name = 5;
248}
249
250message LoadCommitDiff {
251 uint64 project_id = 1;
252 reserved 2;
253 uint64 repository_id = 3;
254 string commit = 4;
255}
256
257message LoadCommitDiffResponse {
258 repeated CommitFile files = 1;
259}
260
261message CommitFile {
262 string path = 1;
263 optional string old_text = 2;
264 optional string new_text = 3;
265}
266
267message GitReset {
268 uint64 project_id = 1;
269 reserved 2;
270 uint64 repository_id = 3;
271 string commit = 4;
272 ResetMode mode = 5;
273 enum ResetMode {
274 SOFT = 0;
275 MIXED = 1;
276 }
277}
278
279message GitCheckoutFiles {
280 uint64 project_id = 1;
281 reserved 2;
282 uint64 repository_id = 3;
283 string commit = 4;
284 repeated string paths = 5;
285}
286
287message GitFileHistory {
288 uint64 project_id = 1;
289 reserved 2;
290 uint64 repository_id = 3;
291 string path = 4;
292}
293
294message GitFileHistoryResponse {
295 repeated FileHistoryEntry entries = 1;
296 string path = 2;
297}
298
299message FileHistoryEntry {
300 string sha = 1;
301 string subject = 2;
302 string message = 3;
303 int64 commit_timestamp = 4;
304 string author_name = 5;
305 string author_email = 6;
306}
307
308// Move to `git.proto` once collab's min version is >=0.171.0.
309message StatusEntry {
310 string repo_path = 1;
311 // Can be removed once collab's min version is >=0.171.0.
312 GitStatus simple_status = 2;
313 GitFileStatus status = 3;
314}
315
316message StashEntry {
317 bytes oid = 1;
318 string message = 2;
319 optional string branch = 3;
320 uint64 index = 4;
321 int64 timestamp = 5;
322}
323
324message Stage {
325 uint64 project_id = 1;
326 reserved 2;
327 uint64 repository_id = 3;
328 repeated string paths = 4;
329}
330
331message Unstage {
332 uint64 project_id = 1;
333 reserved 2;
334 uint64 repository_id = 3;
335 repeated string paths = 4;
336}
337
338message Stash {
339 uint64 project_id = 1;
340 uint64 repository_id = 2;
341 repeated string paths = 3;
342}
343
344message StashPop {
345 uint64 project_id = 1;
346 uint64 repository_id = 2;
347 optional uint64 stash_index = 3;
348}
349
350message StashApply {
351 uint64 project_id = 1;
352 uint64 repository_id = 2;
353 optional uint64 stash_index = 3;
354}
355
356message StashDrop {
357 uint64 project_id = 1;
358 uint64 repository_id = 2;
359 optional uint64 stash_index = 3;
360}
361
362message Commit {
363 uint64 project_id = 1;
364 reserved 2;
365 uint64 repository_id = 3;
366 optional string name = 4;
367 optional string email = 5;
368 string message = 6;
369 optional CommitOptions options = 7;
370 reserved 8;
371 uint64 askpass_id = 9;
372
373 message CommitOptions {
374 bool amend = 1;
375 bool signoff = 2;
376 }
377}
378
379message OpenCommitMessageBuffer {
380 uint64 project_id = 1;
381 reserved 2;
382 uint64 repository_id = 3;
383}
384
385message Push {
386 uint64 project_id = 1;
387 reserved 2;
388 uint64 repository_id = 3;
389 string remote_name = 4;
390 string branch_name = 5;
391 optional PushOptions options = 6;
392 uint64 askpass_id = 7;
393
394 enum PushOptions {
395 SET_UPSTREAM = 0;
396 FORCE = 1;
397 }
398}
399
400message Fetch {
401 uint64 project_id = 1;
402 reserved 2;
403 uint64 repository_id = 3;
404 uint64 askpass_id = 4;
405 optional string remote = 5;
406}
407
408message GetRemotes {
409 uint64 project_id = 1;
410 reserved 2;
411 uint64 repository_id = 3;
412 optional string branch_name = 4;
413}
414
415message GetRemotesResponse {
416 repeated Remote remotes = 1;
417
418 message Remote {
419 string name = 1;
420 }
421}
422
423message Pull {
424 uint64 project_id = 1;
425 reserved 2;
426 uint64 repository_id = 3;
427 string remote_name = 4;
428 optional string branch_name = 5;
429 uint64 askpass_id = 6;
430 bool rebase = 7;
431}
432
433message RemoteMessageResponse {
434 string stdout = 1;
435 string stderr = 2;
436}
437
438message BlameBuffer {
439 uint64 project_id = 1;
440 uint64 buffer_id = 2;
441 repeated VectorClockEntry version = 3;
442}
443
444message BlameEntry {
445 bytes sha = 1;
446
447 uint32 start_line = 2;
448 uint32 end_line = 3;
449 uint32 original_line_number = 4;
450
451 optional string author = 5;
452 optional string author_mail = 6;
453 optional int64 author_time = 7;
454 optional string author_tz = 8;
455
456 optional string committer = 9;
457 optional string committer_mail = 10;
458 optional int64 committer_time = 11;
459 optional string committer_tz = 12;
460
461 optional string summary = 13;
462 optional string previous = 14;
463
464 string filename = 15;
465}
466
467message CommitMessage {
468 bytes oid = 1;
469 string message = 2;
470}
471
472message CommitPermalink {
473 bytes oid = 1;
474 string permalink = 2;
475}
476
477message BlameBufferResponse {
478 message BlameResponse {
479 repeated BlameEntry entries = 1;
480 repeated CommitMessage messages = 2;
481 optional string remote_url = 4;
482 reserved 3;
483 }
484
485 optional BlameResponse blame_response = 5;
486
487 reserved 1 to 4;
488}
489
490message GetDefaultBranch {
491 uint64 project_id = 1;
492 uint64 repository_id = 2;
493}
494
495message GetDefaultBranchResponse {
496 optional string branch = 1;
497}
498
499message GetTreeDiff {
500 uint64 project_id = 1;
501 uint64 repository_id = 2;
502 bool is_merge = 3;
503 string base = 4;
504 string head = 5;
505}
506
507message GetTreeDiffResponse {
508 repeated TreeDiffStatus entries = 1;
509}
510
511message TreeDiffStatus {
512 enum Status {
513 ADDED = 0;
514 MODIFIED = 1;
515 DELETED = 2;
516 }
517
518 Status status = 1;
519 string path = 2;
520 optional string oid = 3;
521}
522
523message GetBlobContent {
524 uint64 project_id = 1;
525 uint64 repository_id = 2;
526 string oid =3;
527}
528
529message GetBlobContentResponse {
530 string content = 1;
531}
532
533message GitGetWorktrees {
534 uint64 project_id = 1;
535 uint64 repository_id = 2;
536}
537
538message GitWorktreesResponse {
539 repeated Worktree worktrees = 1;
540}
541
542message Worktree {
543 string path = 1;
544 string ref_name = 2;
545 string sha = 3;
546}
547
548message GitCreateWorktree {
549 uint64 project_id = 1;
550 uint64 repository_id = 2;
551 string name = 3;
552 string directory = 4;
553 optional string commit = 5;
554}