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 GitClone {
206 uint64 project_id = 1;
207 string abs_path = 2;
208 string remote_repo = 3;
209}
210
211message GitCloneResponse {
212 bool success = 1;
213}
214
215message CheckForPushedCommits {
216 uint64 project_id = 1;
217 reserved 2;
218 uint64 repository_id = 3;
219}
220
221message CheckForPushedCommitsResponse {
222 repeated string pushed_to = 1;
223}
224
225message GitShow {
226 uint64 project_id = 1;
227 reserved 2;
228 uint64 repository_id = 3;
229 string commit = 4;
230}
231
232message GitCommitDetails {
233 string sha = 1;
234 string message = 2;
235 int64 commit_timestamp = 3;
236 string author_email = 4;
237 string author_name = 5;
238}
239
240message LoadCommitDiff {
241 uint64 project_id = 1;
242 reserved 2;
243 uint64 repository_id = 3;
244 string commit = 4;
245}
246
247message LoadCommitDiffResponse {
248 repeated CommitFile files = 1;
249}
250
251message CommitFile {
252 string path = 1;
253 optional string old_text = 2;
254 optional string new_text = 3;
255}
256
257message GitReset {
258 uint64 project_id = 1;
259 reserved 2;
260 uint64 repository_id = 3;
261 string commit = 4;
262 ResetMode mode = 5;
263 enum ResetMode {
264 SOFT = 0;
265 MIXED = 1;
266 }
267}
268
269message GitCheckoutFiles {
270 uint64 project_id = 1;
271 reserved 2;
272 uint64 repository_id = 3;
273 string commit = 4;
274 repeated string paths = 5;
275}
276
277// Move to `git.proto` once collab's min version is >=0.171.0.
278message StatusEntry {
279 string repo_path = 1;
280 // Can be removed once collab's min version is >=0.171.0.
281 GitStatus simple_status = 2;
282 GitFileStatus status = 3;
283}
284
285message Stage {
286 uint64 project_id = 1;
287 reserved 2;
288 uint64 repository_id = 3;
289 repeated string paths = 4;
290}
291
292message Unstage {
293 uint64 project_id = 1;
294 reserved 2;
295 uint64 repository_id = 3;
296 repeated string paths = 4;
297}
298
299message Stash {
300 uint64 project_id = 1;
301 uint64 repository_id = 2;
302 repeated string paths = 3;
303}
304
305message StashPop {
306 uint64 project_id = 1;
307 uint64 repository_id = 2;
308}
309
310message Commit {
311 uint64 project_id = 1;
312 reserved 2;
313 uint64 repository_id = 3;
314 optional string name = 4;
315 optional string email = 5;
316 string message = 6;
317 optional CommitOptions options = 7;
318 reserved 8;
319
320 message CommitOptions {
321 bool amend = 1;
322 bool signoff = 2;
323 }
324}
325
326message OpenCommitMessageBuffer {
327 uint64 project_id = 1;
328 reserved 2;
329 uint64 repository_id = 3;
330}
331
332message Push {
333 uint64 project_id = 1;
334 reserved 2;
335 uint64 repository_id = 3;
336 string remote_name = 4;
337 string branch_name = 5;
338 optional PushOptions options = 6;
339 uint64 askpass_id = 7;
340
341 enum PushOptions {
342 SET_UPSTREAM = 0;
343 FORCE = 1;
344 }
345}
346
347message Fetch {
348 uint64 project_id = 1;
349 reserved 2;
350 uint64 repository_id = 3;
351 uint64 askpass_id = 4;
352 optional string remote = 5;
353}
354
355message GetRemotes {
356 uint64 project_id = 1;
357 reserved 2;
358 uint64 repository_id = 3;
359 optional string branch_name = 4;
360}
361
362message GetRemotesResponse {
363 repeated Remote remotes = 1;
364
365 message Remote {
366 string name = 1;
367 }
368}
369
370message Pull {
371 uint64 project_id = 1;
372 reserved 2;
373 uint64 repository_id = 3;
374 string remote_name = 4;
375 string branch_name = 5;
376 uint64 askpass_id = 6;
377}
378
379message RemoteMessageResponse {
380 string stdout = 1;
381 string stderr = 2;
382}
383
384message BlameBuffer {
385 uint64 project_id = 1;
386 uint64 buffer_id = 2;
387 repeated VectorClockEntry version = 3;
388}
389
390message BlameEntry {
391 bytes sha = 1;
392
393 uint32 start_line = 2;
394 uint32 end_line = 3;
395 uint32 original_line_number = 4;
396
397 optional string author = 5;
398 optional string author_mail = 6;
399 optional int64 author_time = 7;
400 optional string author_tz = 8;
401
402 optional string committer = 9;
403 optional string committer_mail = 10;
404 optional int64 committer_time = 11;
405 optional string committer_tz = 12;
406
407 optional string summary = 13;
408 optional string previous = 14;
409
410 string filename = 15;
411}
412
413message CommitMessage {
414 bytes oid = 1;
415 string message = 2;
416}
417
418message CommitPermalink {
419 bytes oid = 1;
420 string permalink = 2;
421}
422
423message BlameBufferResponse {
424 message BlameResponse {
425 repeated BlameEntry entries = 1;
426 repeated CommitMessage messages = 2;
427 optional string remote_url = 4;
428 reserved 3;
429 }
430
431 optional BlameResponse blame_response = 5;
432
433 reserved 1 to 4;
434}
435
436message GetDefaultBranch {
437 uint64 project_id = 1;
438 uint64 repository_id = 2;
439}
440
441message GetDefaultBranchResponse {
442 optional string branch = 1;
443}