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    reserved 8;
298
299    message CommitOptions {
300        bool amend = 1;
301        bool signoff = 2;
302    }
303}
304
305message OpenCommitMessageBuffer {
306    uint64 project_id = 1;
307    reserved 2;
308    uint64 repository_id = 3;
309}
310
311message Push {
312    uint64 project_id = 1;
313    reserved 2;
314    uint64 repository_id = 3;
315    string remote_name = 4;
316    string branch_name = 5;
317    optional PushOptions options = 6;
318    uint64 askpass_id = 7;
319
320    enum PushOptions {
321        SET_UPSTREAM = 0;
322        FORCE = 1;
323    }
324}
325
326message Fetch {
327    uint64 project_id = 1;
328    reserved 2;
329    uint64 repository_id = 3;
330    uint64 askpass_id = 4;
331    optional string remote = 5;
332}
333
334message GetRemotes {
335    uint64 project_id = 1;
336    reserved 2;
337    uint64 repository_id = 3;
338    optional string branch_name = 4;
339}
340
341message GetRemotesResponse {
342    repeated Remote remotes = 1;
343
344    message Remote {
345        string name = 1;
346    }
347}
348
349message Pull {
350    uint64 project_id = 1;
351    reserved 2;
352    uint64 repository_id = 3;
353    string remote_name = 4;
354    string branch_name = 5;
355    uint64 askpass_id = 6;
356}
357
358message RemoteMessageResponse {
359    string stdout = 1;
360    string stderr = 2;
361}
362
363message BlameBuffer {
364    uint64 project_id = 1;
365    uint64 buffer_id = 2;
366    repeated VectorClockEntry version = 3;
367}
368
369message BlameEntry {
370    bytes sha = 1;
371
372    uint32 start_line = 2;
373    uint32 end_line = 3;
374    uint32 original_line_number = 4;
375
376    optional string author = 5;
377    optional string author_mail = 6;
378    optional int64 author_time = 7;
379    optional string author_tz = 8;
380
381    optional string committer = 9;
382    optional string committer_mail = 10;
383    optional int64 committer_time = 11;
384    optional string committer_tz = 12;
385
386    optional string summary = 13;
387    optional string previous = 14;
388
389    string filename = 15;
390}
391
392message CommitMessage {
393    bytes oid = 1;
394    string message = 2;
395}
396
397message CommitPermalink {
398    bytes oid = 1;
399    string permalink = 2;
400}
401
402message BlameBufferResponse {
403    message BlameResponse {
404        repeated BlameEntry entries = 1;
405        repeated CommitMessage messages = 2;
406        optional string remote_url = 4;
407        reserved 3;
408    }
409
410    optional BlameResponse blame_response = 5;
411
412    reserved 1 to 4;
413}