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