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