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 GitDeleteBranch {
194 uint64 project_id = 1;
195 uint64 repository_id = 2;
196 string branch_name = 3;
197}
198
199message GitDiff {
200 uint64 project_id = 1;
201 reserved 2;
202 uint64 repository_id = 3;
203 DiffType diff_type = 4;
204
205 enum DiffType {
206 HEAD_TO_WORKTREE = 0;
207 HEAD_TO_INDEX = 1;
208 }
209}
210
211message GitDiffResponse {
212 string diff = 1;
213}
214
215message GitInit {
216 uint64 project_id = 1;
217 string abs_path = 2;
218 string fallback_branch_name = 3;
219}
220
221message GitClone {
222 uint64 project_id = 1;
223 string abs_path = 2;
224 string remote_repo = 3;
225}
226
227message GitCloneResponse {
228 bool success = 1;
229}
230
231message CheckForPushedCommits {
232 uint64 project_id = 1;
233 reserved 2;
234 uint64 repository_id = 3;
235}
236
237message CheckForPushedCommitsResponse {
238 repeated string pushed_to = 1;
239}
240
241message GitShow {
242 uint64 project_id = 1;
243 reserved 2;
244 uint64 repository_id = 3;
245 string commit = 4;
246}
247
248message GitCommitDetails {
249 string sha = 1;
250 string message = 2;
251 int64 commit_timestamp = 3;
252 string author_email = 4;
253 string author_name = 5;
254}
255
256message LoadCommitDiff {
257 uint64 project_id = 1;
258 reserved 2;
259 uint64 repository_id = 3;
260 string commit = 4;
261}
262
263message LoadCommitDiffResponse {
264 repeated CommitFile files = 1;
265}
266
267message CommitFile {
268 string path = 1;
269 optional string old_text = 2;
270 optional string new_text = 3;
271}
272
273message GitReset {
274 uint64 project_id = 1;
275 reserved 2;
276 uint64 repository_id = 3;
277 string commit = 4;
278 ResetMode mode = 5;
279 enum ResetMode {
280 SOFT = 0;
281 MIXED = 1;
282 }
283}
284
285message GitCheckoutFiles {
286 uint64 project_id = 1;
287 reserved 2;
288 uint64 repository_id = 3;
289 string commit = 4;
290 repeated string paths = 5;
291}
292
293message GitFileHistory {
294 uint64 project_id = 1;
295 reserved 2;
296 uint64 repository_id = 3;
297 string path = 4;
298 uint64 skip = 5;
299 optional uint64 limit = 6;
300}
301
302message GitFileHistoryResponse {
303 repeated FileHistoryEntry entries = 1;
304 string path = 2;
305}
306
307message FileHistoryEntry {
308 string sha = 1;
309 string subject = 2;
310 string message = 3;
311 int64 commit_timestamp = 4;
312 string author_name = 5;
313 string author_email = 6;
314}
315
316// Move to `git.proto` once collab's min version is >=0.171.0.
317message StatusEntry {
318 string repo_path = 1;
319 // Can be removed once collab's min version is >=0.171.0.
320 GitStatus simple_status = 2;
321 GitFileStatus status = 3;
322}
323
324message StashEntry {
325 bytes oid = 1;
326 string message = 2;
327 optional string branch = 3;
328 uint64 index = 4;
329 int64 timestamp = 5;
330}
331
332message Stage {
333 uint64 project_id = 1;
334 reserved 2;
335 uint64 repository_id = 3;
336 repeated string paths = 4;
337}
338
339message Unstage {
340 uint64 project_id = 1;
341 reserved 2;
342 uint64 repository_id = 3;
343 repeated string paths = 4;
344}
345
346message Stash {
347 uint64 project_id = 1;
348 uint64 repository_id = 2;
349 repeated string paths = 3;
350}
351
352message StashPop {
353 uint64 project_id = 1;
354 uint64 repository_id = 2;
355 optional uint64 stash_index = 3;
356}
357
358message StashApply {
359 uint64 project_id = 1;
360 uint64 repository_id = 2;
361 optional uint64 stash_index = 3;
362}
363
364message StashDrop {
365 uint64 project_id = 1;
366 uint64 repository_id = 2;
367 optional uint64 stash_index = 3;
368}
369
370message Commit {
371 uint64 project_id = 1;
372 reserved 2;
373 uint64 repository_id = 3;
374 optional string name = 4;
375 optional string email = 5;
376 string message = 6;
377 optional CommitOptions options = 7;
378 reserved 8;
379 uint64 askpass_id = 9;
380
381 message CommitOptions {
382 bool amend = 1;
383 bool signoff = 2;
384 }
385}
386
387message OpenCommitMessageBuffer {
388 uint64 project_id = 1;
389 reserved 2;
390 uint64 repository_id = 3;
391}
392
393message Push {
394 uint64 project_id = 1;
395 reserved 2;
396 uint64 repository_id = 3;
397 string remote_name = 4;
398 string branch_name = 5;
399 optional PushOptions options = 6;
400 uint64 askpass_id = 7;
401
402 enum PushOptions {
403 SET_UPSTREAM = 0;
404 FORCE = 1;
405 }
406}
407
408message Fetch {
409 uint64 project_id = 1;
410 reserved 2;
411 uint64 repository_id = 3;
412 uint64 askpass_id = 4;
413 optional string remote = 5;
414}
415
416message GetRemotes {
417 uint64 project_id = 1;
418 reserved 2;
419 uint64 repository_id = 3;
420 optional string branch_name = 4;
421 bool is_push = 5;
422}
423
424message GetRemotesResponse {
425 repeated Remote remotes = 1;
426
427 message Remote {
428 string name = 1;
429 }
430}
431
432message Pull {
433 uint64 project_id = 1;
434 reserved 2;
435 uint64 repository_id = 3;
436 string remote_name = 4;
437 optional string branch_name = 5;
438 uint64 askpass_id = 6;
439 bool rebase = 7;
440}
441
442message RemoteMessageResponse {
443 string stdout = 1;
444 string stderr = 2;
445}
446
447message BlameBuffer {
448 uint64 project_id = 1;
449 uint64 buffer_id = 2;
450 repeated VectorClockEntry version = 3;
451}
452
453message BlameEntry {
454 bytes sha = 1;
455
456 uint32 start_line = 2;
457 uint32 end_line = 3;
458 uint32 original_line_number = 4;
459
460 optional string author = 5;
461 optional string author_mail = 6;
462 optional int64 author_time = 7;
463 optional string author_tz = 8;
464
465 optional string committer = 9;
466 optional string committer_mail = 10;
467 optional int64 committer_time = 11;
468 optional string committer_tz = 12;
469
470 optional string summary = 13;
471 optional string previous = 14;
472
473 string filename = 15;
474}
475
476message CommitMessage {
477 bytes oid = 1;
478 string message = 2;
479}
480
481message CommitPermalink {
482 bytes oid = 1;
483 string permalink = 2;
484}
485
486message BlameBufferResponse {
487 message BlameResponse {
488 repeated BlameEntry entries = 1;
489 repeated CommitMessage messages = 2;
490 optional string remote_url = 4;
491 reserved 3;
492 }
493
494 optional BlameResponse blame_response = 5;
495
496 reserved 1 to 4;
497}
498
499message GetDefaultBranch {
500 uint64 project_id = 1;
501 uint64 repository_id = 2;
502}
503
504message GetDefaultBranchResponse {
505 optional string branch = 1;
506}
507
508message GetTreeDiff {
509 uint64 project_id = 1;
510 uint64 repository_id = 2;
511 bool is_merge = 3;
512 string base = 4;
513 string head = 5;
514}
515
516message GetTreeDiffResponse {
517 repeated TreeDiffStatus entries = 1;
518}
519
520message TreeDiffStatus {
521 enum Status {
522 ADDED = 0;
523 MODIFIED = 1;
524 DELETED = 2;
525 }
526
527 Status status = 1;
528 string path = 2;
529 optional string oid = 3;
530}
531
532message GetBlobContent {
533 uint64 project_id = 1;
534 uint64 repository_id = 2;
535 string oid =3;
536}
537
538message GetBlobContentResponse {
539 string content = 1;
540}
541
542message GitGetWorktrees {
543 uint64 project_id = 1;
544 uint64 repository_id = 2;
545}
546
547message GitWorktreesResponse {
548 repeated Worktree worktrees = 1;
549}
550
551message Worktree {
552 string path = 1;
553 string ref_name = 2;
554 string sha = 3;
555}
556
557message GitCreateWorktree {
558 uint64 project_id = 1;
559 uint64 repository_id = 2;
560 string name = 3;
561 string directory = 4;
562 optional string commit = 5;
563}
564
565message RunGitHook {
566 enum GitHook {
567 PRE_COMMIT = 0;
568 }
569
570 uint64 project_id = 1;
571 uint64 repository_id = 2;
572 GitHook hook = 3;
573}