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