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
351    message CommitOptions {
352        bool amend = 1;
353        bool signoff = 2;
354    }
355}
356
357message OpenCommitMessageBuffer {
358    uint64 project_id = 1;
359    reserved 2;
360    uint64 repository_id = 3;
361}
362
363message Push {
364    uint64 project_id = 1;
365    reserved 2;
366    uint64 repository_id = 3;
367    string remote_name = 4;
368    string branch_name = 5;
369    optional PushOptions options = 6;
370    uint64 askpass_id = 7;
371
372    enum PushOptions {
373        SET_UPSTREAM = 0;
374        FORCE = 1;
375    }
376}
377
378message Fetch {
379    uint64 project_id = 1;
380    reserved 2;
381    uint64 repository_id = 3;
382    uint64 askpass_id = 4;
383    optional string remote = 5;
384}
385
386message GetRemotes {
387    uint64 project_id = 1;
388    reserved 2;
389    uint64 repository_id = 3;
390    optional string branch_name = 4;
391}
392
393message GetRemotesResponse {
394    repeated Remote remotes = 1;
395
396    message Remote {
397        string name = 1;
398    }
399}
400
401message Pull {
402    uint64 project_id = 1;
403    reserved 2;
404    uint64 repository_id = 3;
405    string remote_name = 4;
406    string branch_name = 5;
407    uint64 askpass_id = 6;
408}
409
410message RemoteMessageResponse {
411    string stdout = 1;
412    string stderr = 2;
413}
414
415message BlameBuffer {
416    uint64 project_id = 1;
417    uint64 buffer_id = 2;
418    repeated VectorClockEntry version = 3;
419}
420
421message BlameEntry {
422    bytes sha = 1;
423
424    uint32 start_line = 2;
425    uint32 end_line = 3;
426    uint32 original_line_number = 4;
427
428    optional string author = 5;
429    optional string author_mail = 6;
430    optional int64 author_time = 7;
431    optional string author_tz = 8;
432
433    optional string committer = 9;
434    optional string committer_mail = 10;
435    optional int64 committer_time = 11;
436    optional string committer_tz = 12;
437
438    optional string summary = 13;
439    optional string previous = 14;
440
441    string filename = 15;
442}
443
444message CommitMessage {
445    bytes oid = 1;
446    string message = 2;
447}
448
449message CommitPermalink {
450    bytes oid = 1;
451    string permalink = 2;
452}
453
454message BlameBufferResponse {
455    message BlameResponse {
456        repeated BlameEntry entries = 1;
457        repeated CommitMessage messages = 2;
458        optional string remote_url = 4;
459        reserved 3;
460    }
461
462    optional BlameResponse blame_response = 5;
463
464    reserved 1 to 4;
465}
466
467message GetDefaultBranch {
468    uint64 project_id = 1;
469    uint64 repository_id = 2;
470}
471
472message GetDefaultBranchResponse {
473    optional string branch = 1;
474}
475
476message GetTreeDiff {
477    uint64 project_id = 1;
478    uint64 repository_id = 2;
479    bool is_merge = 3;
480    string base = 4;
481    string head = 5;
482}
483
484message GetTreeDiffResponse {
485    repeated TreeDiffStatus entries = 1;
486}
487
488message TreeDiffStatus {
489    enum Status {
490        ADDED = 0;
491        MODIFIED = 1;
492        DELETED = 2;
493    }
494
495    Status status = 1;
496    string path = 2;
497    optional string oid = 3;
498}
499
500message GetBlobContent {
501    uint64 project_id = 1;
502    uint64 repository_id = 2;
503    string oid =3;
504}
505
506message GetBlobContentResponse {
507    string content = 1;
508}