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