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