git.proto

  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
287// Move to `git.proto` once collab's min version is >=0.171.0.
288message StatusEntry {
289    string repo_path = 1;
290    // Can be removed once collab's min version is >=0.171.0.
291    GitStatus simple_status = 2;
292    GitFileStatus status = 3;
293}
294
295message StashEntry {
296    bytes oid = 1;
297    string message = 2;
298    optional string branch = 3;
299    uint64 index = 4;
300    int64 timestamp = 5;
301}
302
303message Stage {
304    uint64 project_id = 1;
305    reserved 2;
306    uint64 repository_id = 3;
307    repeated string paths = 4;
308}
309
310message Unstage {
311    uint64 project_id = 1;
312    reserved 2;
313    uint64 repository_id = 3;
314    repeated string paths = 4;
315}
316
317message Stash {
318    uint64 project_id = 1;
319    uint64 repository_id = 2;
320    repeated string paths = 3;
321}
322
323message StashPop {
324    uint64 project_id = 1;
325    uint64 repository_id = 2;
326    optional uint64 stash_index = 3;
327}
328
329message StashApply {
330    uint64 project_id = 1;
331    uint64 repository_id = 2;
332    optional uint64 stash_index = 3;
333}
334
335message StashDrop {
336    uint64 project_id = 1;
337    uint64 repository_id = 2;
338    optional uint64 stash_index = 3;
339}
340
341message Commit {
342    uint64 project_id = 1;
343    reserved 2;
344    uint64 repository_id = 3;
345    optional string name = 4;
346    optional string email = 5;
347    string message = 6;
348    optional CommitOptions options = 7;
349    reserved 8;
350    uint64 askpass_id = 9;
351
352    message CommitOptions {
353        bool amend = 1;
354        bool signoff = 2;
355    }
356}
357
358message OpenCommitMessageBuffer {
359    uint64 project_id = 1;
360    reserved 2;
361    uint64 repository_id = 3;
362}
363
364message Push {
365    uint64 project_id = 1;
366    reserved 2;
367    uint64 repository_id = 3;
368    string remote_name = 4;
369    string branch_name = 5;
370    optional PushOptions options = 6;
371    uint64 askpass_id = 7;
372
373    enum PushOptions {
374        SET_UPSTREAM = 0;
375        FORCE = 1;
376    }
377}
378
379message Fetch {
380    uint64 project_id = 1;
381    reserved 2;
382    uint64 repository_id = 3;
383    uint64 askpass_id = 4;
384    optional string remote = 5;
385}
386
387message GetRemotes {
388    uint64 project_id = 1;
389    reserved 2;
390    uint64 repository_id = 3;
391    optional string branch_name = 4;
392}
393
394message GetRemotesResponse {
395    repeated Remote remotes = 1;
396
397    message Remote {
398        string name = 1;
399    }
400}
401
402message Pull {
403    uint64 project_id = 1;
404    reserved 2;
405    uint64 repository_id = 3;
406    string remote_name = 4;
407    optional string branch_name = 5;
408    uint64 askpass_id = 6;
409    bool rebase = 7;
410}
411
412message RemoteMessageResponse {
413    string stdout = 1;
414    string stderr = 2;
415}
416
417message BlameBuffer {
418    uint64 project_id = 1;
419    uint64 buffer_id = 2;
420    repeated VectorClockEntry version = 3;
421}
422
423message BlameEntry {
424    bytes sha = 1;
425
426    uint32 start_line = 2;
427    uint32 end_line = 3;
428    uint32 original_line_number = 4;
429
430    optional string author = 5;
431    optional string author_mail = 6;
432    optional int64 author_time = 7;
433    optional string author_tz = 8;
434
435    optional string committer = 9;
436    optional string committer_mail = 10;
437    optional int64 committer_time = 11;
438    optional string committer_tz = 12;
439
440    optional string summary = 13;
441    optional string previous = 14;
442
443    string filename = 15;
444}
445
446message CommitMessage {
447    bytes oid = 1;
448    string message = 2;
449}
450
451message CommitPermalink {
452    bytes oid = 1;
453    string permalink = 2;
454}
455
456message BlameBufferResponse {
457    message BlameResponse {
458        repeated BlameEntry entries = 1;
459        repeated CommitMessage messages = 2;
460        optional string remote_url = 4;
461        reserved 3;
462    }
463
464    optional BlameResponse blame_response = 5;
465
466    reserved 1 to 4;
467}
468
469message GetDefaultBranch {
470    uint64 project_id = 1;
471    uint64 repository_id = 2;
472}
473
474message GetDefaultBranchResponse {
475    optional string branch = 1;
476}
477
478message GetTreeDiff {
479    uint64 project_id = 1;
480    uint64 repository_id = 2;
481    bool is_merge = 3;
482    string base = 4;
483    string head = 5;
484}
485
486message GetTreeDiffResponse {
487    repeated TreeDiffStatus entries = 1;
488}
489
490message TreeDiffStatus {
491    enum Status {
492        ADDED = 0;
493        MODIFIED = 1;
494        DELETED = 2;
495    }
496
497    Status status = 1;
498    string path = 2;
499    optional string oid = 3;
500}
501
502message GetBlobContent {
503    uint64 project_id = 1;
504    uint64 repository_id = 2;
505    string oid =3;
506}
507
508message GetBlobContentResponse {
509    string content = 1;
510}
511
512message GitGetWorktrees {
513    uint64 project_id = 1;
514    uint64 repository_id = 2;
515}
516
517message GitWorktreesResponse {
518    repeated Worktree worktrees = 1;
519}
520
521message Worktree {
522    string path = 1;
523    string ref_name = 2;
524    string sha = 3;
525}
526
527message GitCreateWorktree {
528    uint64 project_id = 1;
529    uint64 repository_id = 2;
530    string name = 3;
531    string directory = 4;
532    optional string commit = 5;
533}