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}
 99
100message GitBranches {
101    uint64 project_id = 1;
102    ProjectPath repository = 2;
103}
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}
125
126message RemoveRepository {
127    uint64 project_id = 1;
128    uint64 id = 2;
129}
130
131enum GitStatus {
132    Added = 0;
133    Modified = 1;
134    Conflict = 2;
135    Deleted = 3;
136    Updated = 4;
137    TypeChanged = 5;
138    Renamed = 6;
139    Copied = 7;
140    Unmodified = 8;
141}
142
143message GitFileStatus {
144    oneof variant {
145        Untracked untracked = 1;
146        Ignored ignored = 2;
147        Unmerged unmerged = 3;
148        Tracked tracked = 4;
149    }
150
151    message Untracked {}
152    message Ignored {}
153    message Unmerged {
154        GitStatus first_head = 1;
155        GitStatus second_head = 2;
156    }
157    message Tracked {
158        GitStatus index_status = 1;
159        GitStatus worktree_status = 2;
160    }
161}
162
163message GitGetBranches {
164    uint64 project_id = 1;
165    reserved 2;
166    uint64 repository_id = 3;
167}
168
169message GitCreateBranch {
170    uint64 project_id = 1;
171    reserved 2;
172    uint64 repository_id = 3;
173    string branch_name = 4;
174}
175
176message GitChangeBranch {
177    uint64 project_id = 1;
178    reserved 2;
179    uint64 repository_id = 3;
180    string branch_name = 4;
181}
182
183message GitDiff {
184    uint64 project_id = 1;
185    reserved 2;
186    uint64 repository_id = 3;
187    DiffType diff_type = 4;
188
189    enum DiffType {
190        HEAD_TO_WORKTREE = 0;
191        HEAD_TO_INDEX = 1;
192    }
193}
194
195message GitDiffResponse {
196    string diff = 1;
197}
198
199message GitInit {
200    uint64 project_id = 1;
201    string abs_path = 2;
202    string fallback_branch_name = 3;
203}
204
205message CheckForPushedCommits {
206    uint64 project_id = 1;
207    reserved 2;
208    uint64 repository_id = 3;
209}
210
211message CheckForPushedCommitsResponse {
212  repeated string pushed_to = 1;
213}
214
215message GitShow {
216    uint64 project_id = 1;
217    reserved 2;
218    uint64 repository_id = 3;
219    string commit = 4;
220}
221
222message GitCommitDetails {
223    string sha = 1;
224    string message = 2;
225    int64 commit_timestamp = 3;
226    string author_email = 4;
227    string author_name = 5;
228}
229
230message LoadCommitDiff {
231    uint64 project_id = 1;
232    reserved 2;
233    uint64 repository_id = 3;
234    string commit = 4;
235}
236
237message LoadCommitDiffResponse {
238    repeated CommitFile files = 1;
239}
240
241message CommitFile {
242    string path = 1;
243    optional string old_text = 2;
244    optional string new_text = 3;
245}
246
247message GitReset {
248    uint64 project_id = 1;
249    reserved 2;
250    uint64 repository_id = 3;
251    string commit = 4;
252    ResetMode mode = 5;
253    enum ResetMode {
254        SOFT = 0;
255        MIXED = 1;
256    }
257}
258
259message GitCheckoutFiles {
260    uint64 project_id = 1;
261    reserved 2;
262    uint64 repository_id = 3;
263    string commit = 4;
264    repeated string paths = 5;
265}
266
267// Move to `git.proto` once collab's min version is >=0.171.0.
268message StatusEntry {
269    string repo_path = 1;
270    // Can be removed once collab's min version is >=0.171.0.
271    GitStatus simple_status = 2;
272    GitFileStatus status = 3;
273}
274
275message Stage {
276    uint64 project_id = 1;
277    reserved 2;
278    uint64 repository_id = 3;
279    repeated string paths = 4;
280}
281
282message Unstage {
283    uint64 project_id = 1;
284    reserved 2;
285    uint64 repository_id = 3;
286    repeated string paths = 4;
287}
288
289message Commit {
290    uint64 project_id = 1;
291    reserved 2;
292    uint64 repository_id = 3;
293    optional string name = 4;
294    optional string email = 5;
295    string message = 6;
296    optional CommitOptions options = 7;
297
298    message CommitOptions {
299        bool amend = 1;
300    }
301}
302
303message OpenCommitMessageBuffer {
304    uint64 project_id = 1;
305    reserved 2;
306    uint64 repository_id = 3;
307}
308
309message Push {
310    uint64 project_id = 1;
311    reserved 2;
312    uint64 repository_id = 3;
313    string remote_name = 4;
314    string branch_name = 5;
315    optional PushOptions options = 6;
316    uint64 askpass_id = 7;
317
318    enum PushOptions {
319        SET_UPSTREAM = 0;
320        FORCE = 1;
321    }
322}
323
324message Fetch {
325    uint64 project_id = 1;
326    reserved 2;
327    uint64 repository_id = 3;
328    uint64 askpass_id = 4;
329}
330
331message GetRemotes {
332    uint64 project_id = 1;
333    reserved 2;
334    uint64 repository_id = 3;
335    optional string branch_name = 4;
336}
337
338message GetRemotesResponse {
339    repeated Remote remotes = 1;
340
341    message Remote {
342        string name = 1;
343    }
344}
345
346message Pull {
347    uint64 project_id = 1;
348    reserved 2;
349    uint64 repository_id = 3;
350    string remote_name = 4;
351    string branch_name = 5;
352    uint64 askpass_id = 6;
353}
354
355message RemoteMessageResponse {
356    string stdout = 1;
357    string stderr = 2;
358}
359
360message BlameBuffer {
361    uint64 project_id = 1;
362    uint64 buffer_id = 2;
363    repeated VectorClockEntry version = 3;
364}
365
366message BlameEntry {
367    bytes sha = 1;
368
369    uint32 start_line = 2;
370    uint32 end_line = 3;
371    uint32 original_line_number = 4;
372
373    optional string author = 5;
374    optional string author_mail = 6;
375    optional int64 author_time = 7;
376    optional string author_tz = 8;
377
378    optional string committer = 9;
379    optional string committer_mail = 10;
380    optional int64 committer_time = 11;
381    optional string committer_tz = 12;
382
383    optional string summary = 13;
384    optional string previous = 14;
385
386    string filename = 15;
387}
388
389message CommitMessage {
390    bytes oid = 1;
391    string message = 2;
392}
393
394message CommitPermalink {
395    bytes oid = 1;
396    string permalink = 2;
397}
398
399message BlameBufferResponse {
400    message BlameResponse {
401        repeated BlameEntry entries = 1;
402        repeated CommitMessage messages = 2;
403        optional string remote_url = 4;
404        reserved 3;
405    }
406
407    optional BlameResponse blame_response = 5;
408
409    reserved 1 to 4;
410}