git.proto

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