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