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