Blob


1 /*
2 * Copyright (c) 2018, 2019 Stefan Sperling <stsp@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 struct got_worktree;
18 struct got_commitable;
19 struct got_commit_object;
20 struct got_fileindex;
22 /* status codes */
23 #define GOT_STATUS_NO_CHANGE ' '
24 #define GOT_STATUS_ADD 'A'
25 #define GOT_STATUS_EXISTS 'E'
26 #define GOT_STATUS_UPDATE 'U'
27 #define GOT_STATUS_DELETE 'D'
28 #define GOT_STATUS_MODIFY 'M'
29 #define GOT_STATUS_MODE_CHANGE 'm'
30 #define GOT_STATUS_CONFLICT 'C'
31 #define GOT_STATUS_MERGE 'G'
32 #define GOT_STATUS_MISSING '!'
33 #define GOT_STATUS_UNVERSIONED '?'
34 #define GOT_STATUS_OBSTRUCTED '~'
35 #define GOT_STATUS_NONEXISTENT 'N'
36 #define GOT_STATUS_REVERT 'R'
37 #define GOT_STATUS_CANNOT_DELETE 'd'
38 #define GOT_STATUS_BUMP_BASE 'b'
39 #define GOT_STATUS_BASE_REF_ERR 'B'
40 #define GOT_STATUS_CANNOT_UPDATE '#'
42 /*
43 * Attempt to initialize a new work tree on disk.
44 * The first argument is the path to a directory where the work tree
45 * will be created. The path itself must not yet exist, but the dirname(3)
46 * of the path must already exist.
47 * The reference provided will be used to determine the new worktree's
48 * base commit. The third argument speficies the work tree's path prefix.
49 */
50 const struct got_error *got_worktree_init(const char *, struct got_reference *,
51 const char *, struct got_repository *);
53 /*
54 * Attempt to open a worktree at or above the specified path.
55 * The caller must dispose of it with got_worktree_close().
56 */
57 const struct got_error *got_worktree_open(struct got_worktree **, const char *);
59 /* Dispose of an open work tree. */
60 const struct got_error *got_worktree_close(struct got_worktree *);
62 /*
63 * Get the path to the root directory of a worktree.
64 */
65 const char *got_worktree_get_root_path(struct got_worktree *);
67 /*
68 * Get the path to the repository associated with a worktree.
69 */
70 const char *got_worktree_get_repo_path(struct got_worktree *);
72 /*
73 * Get the path prefix associated with a worktree.
74 */
75 const char *got_worktree_get_path_prefix(struct got_worktree *);
77 /*
78 * Get the UUID of a work tree as a string.
79 * The caller must dispose of the returned UUID string with free(3).
80 */
81 const struct got_error *got_worktree_get_uuid(char **, struct got_worktree *);
83 /*
84 * Check if a user-provided path prefix matches that of the worktree.
85 */
86 const struct got_error *got_worktree_match_path_prefix(int *,
87 struct got_worktree *, const char *);
89 /*
90 * Prefix for references pointing at base commit of backout/cherrypick commits.
91 * Reference path takes the form: PREFIX-WORKTREE_UUID-COMMIT_ID
92 */
93 #define GOT_WORKTREE_CHERRYPICK_REF_PREFIX "refs/got/worktree/cherrypick"
94 #define GOT_WORKTREE_BACKOUT_REF_PREFIX "refs/got/worktree/backout"
96 #define GOT_WORKTREE_CHERRYPICK_REF_PREFIX_LEN \
97 sizeof(GOT_WORKTREE_CHERRYPICK_REF_PREFIX) - 1
98 #define GOT_WORKTREE_BACKOUT_REF_PREFIX_LEN \
99 sizeof(GOT_WORKTREE_BACKOUT_REF_PREFIX) - 1
100 #define GOT_WORKTREE_UUID_STRLEN 36
102 const struct got_error *got_worktree_get_logmsg_ref_name(char **,
103 struct got_worktree *, const char *);
104 /*
105 * Get the name of a work tree's HEAD reference.
106 */
107 const char *got_worktree_get_head_ref_name(struct got_worktree *);
109 /*
110 * Set the branch head reference of the work tree.
111 */
112 const struct got_error *got_worktree_set_head_ref(struct got_worktree *,
113 struct got_reference *);
115 /*
116 * Get the current base commit ID of a worktree.
117 */
118 struct got_object_id *got_worktree_get_base_commit_id(struct got_worktree *);
120 /*
121 * Set the base commit Id of a worktree.
122 */
123 const struct got_error *got_worktree_set_base_commit_id(struct got_worktree *,
124 struct got_repository *, struct got_object_id *);
126 /*
127 * Obtain a parsed representation of this worktree's got.conf file.
128 * Return NULL if this configuration file could not be read.
129 */
130 const struct got_gotconfig *got_worktree_get_gotconfig(struct got_worktree *);
132 /* A callback function which is invoked when a path is checked out. */
133 typedef const struct got_error *(*got_worktree_checkout_cb)(void *,
134 unsigned char, const char *);
136 /* A callback function which is invoked when a path is removed. */
137 typedef const struct got_error *(*got_worktree_delete_cb)(void *,
138 unsigned char, unsigned char, const char *);
140 /*
141 * Attempt to check out files into a work tree from its associated repository
142 * and path prefix, and update the work tree's file index accordingly.
143 * File content is obtained from blobs within the work tree's path prefix
144 * inside the tree corresponding to the work tree's base commit.
145 * The checkout progress callback will be invoked with the provided
146 * void * argument, and the path of each checked out file.
148 * It is possible to restrict the checkout operation to specific paths in
149 * the work tree, in which case all files outside those paths will remain at
150 * their currently recorded base commit. Inconsistent base commits can be
151 * repaired later by running another update operation across the entire work
152 * tree. Inconsistent base-commits may also occur if this function runs into
153 * an error or if the checkout operation is cancelled by the cancel callback.
154 * Allspecified paths are relative to the work tree's root. Pass a pathlist
155 * with a single empty path "" to check out files across the entire work tree.
157 * Some operations may refuse to run while the work tree contains files from
158 * multiple base commits.
159 */
160 const struct got_error *got_worktree_checkout_files(struct got_worktree *,
161 struct got_pathlist_head *, struct got_repository *,
162 got_worktree_checkout_cb, void *, got_cancel_cb, void *);
164 /* Merge the differences between two commits into a work tree. */
165 const struct got_error *
166 got_worktree_merge_files(struct got_worktree *,
167 struct got_object_id *, struct got_object_id *,
168 struct got_repository *, got_worktree_checkout_cb, void *,
169 got_cancel_cb, void *);
171 /*
172 * A callback function which is invoked to report a file's status.
174 * If a valid directory file descriptor and a directory entry name are passed,
175 * these should be used to open the file instead of opening the file by path.
176 * This prevents race conditions if the filesystem is modified concurrently.
177 * If the directory descriptor is not available then its value will be -1.
178 */
179 typedef const struct got_error *(*got_worktree_status_cb)(void *,
180 unsigned char, unsigned char, const char *, struct got_object_id *,
181 struct got_object_id *, struct got_object_id *, int, const char *);
183 /*
184 * Report the status of paths in the work tree.
185 * The status callback will be invoked with the provided void * argument,
186 * a path, and a corresponding status code.
187 */
188 const struct got_error *got_worktree_status(struct got_worktree *,
189 struct got_pathlist_head *, struct got_repository *, int no_ignores,
190 got_worktree_status_cb, void *, got_cancel_cb cancel_cb, void *);
192 /*
193 * Try to resolve a user-provided path to an on-disk path in the work tree.
194 * The caller must dispose of the resolved path with free(3).
195 */
196 const struct got_error *got_worktree_resolve_path(char **,
197 struct got_worktree *, const char *);
199 /* Schedule files at on-disk paths for addition in the next commit. */
200 const struct got_error *got_worktree_schedule_add(struct got_worktree *,
201 struct got_pathlist_head *, got_worktree_checkout_cb, void *,
202 struct got_repository *, int);
204 /*
205 * Remove files from disk and schedule them to be deleted in the next commit.
206 * Don't allow deleting files with uncommitted modifications, unless the
207 * parameter 'delete_local_mods' is set.
208 */
209 const struct got_error *
210 got_worktree_schedule_delete(struct got_worktree *,
211 struct got_pathlist_head *, int, const char *,
212 got_worktree_delete_cb, void *, struct got_repository *, int, int);
214 /* A callback function which is used to select or reject a patch. */
215 typedef const struct got_error *(*got_worktree_patch_cb)(int *, void *,
216 unsigned char, const char *, FILE *, int, int);
218 /* Values for result output parameter of got_wortree_patch_cb. */
219 #define GOT_PATCH_CHOICE_NONE 0
220 #define GOT_PATCH_CHOICE_YES 1
221 #define GOT_PATCH_CHOICE_NO 2
222 #define GOT_PATCH_CHOICE_QUIT 3
224 /*
225 * Revert a file at the specified path such that it matches its
226 * original state in the worktree's base commit.
227 * If the patch callback is not NULL, call it to select patch hunks to
228 * revert. Otherwise, revert the whole file found at each path.
229 */
230 const struct got_error *got_worktree_revert(struct got_worktree *,
231 struct got_pathlist_head *, got_worktree_checkout_cb, void *,
232 got_worktree_patch_cb patch_cb, void *patch_arg,
233 struct got_repository *);
235 /*
236 * A callback function which is invoked when a commit message is requested.
237 * Passes a pathlist with a struct got_commitable * in the data pointer of
238 * each element, the path to a file which contains a diff of changes to be
239 * committed (may be NULL), and a pointer to the log message that must be
240 * set by the callback and will be freed after committing, and an argument
241 * passed through to the callback.
242 */
243 typedef const struct got_error *(*got_worktree_commit_msg_cb)(
244 struct got_pathlist_head *, const char *, char **, void *);
246 /*
247 * Create a new commit from changes in the work tree.
248 * Return the ID of the newly created commit.
249 * The worktree's base commit will be set to this new commit.
250 * Files unaffected by this commit operation will retain their
251 * current base commit.
252 * An author and a non-empty log message must be specified.
253 * The name of the committer is optional (may be NULL).
254 * If a path to be committed contains a symlink which points outside
255 * of the path space under version control, raise an error unless
256 * committing of such paths is being forced by the caller.
257 */
258 const struct got_error *got_worktree_commit(struct got_object_id **,
259 struct got_worktree *, struct got_pathlist_head *, const char *,
260 const char *, int, int, int, got_worktree_commit_msg_cb, void *,
261 got_worktree_status_cb, void *, struct got_repository *);
263 /* Get the path of a commitable worktree item. */
264 const char *got_commitable_get_path(struct got_commitable *);
266 /* Get the status of a commitable worktree item. */
267 unsigned int got_commitable_get_status(struct got_commitable *);
269 /*
270 * Prepare for rebasing a branch onto the work tree's current branch.
271 * This function creates references to a temporary branch, the branch
272 * being rebased, and the work tree's current branch, under the
273 * "got/worktree/rebase/" namespace. These references are used to
274 * keep track of rebase operation state and are used as input and/or
275 * output arguments with other rebase-related functions.
276 * The function also returns a pointer to a fileindex which must be
277 * passed back to other rebase-related functions.
278 */
279 const struct got_error *got_worktree_rebase_prepare(struct got_reference **,
280 struct got_reference **, struct got_fileindex **, struct got_worktree *,
281 struct got_reference *, struct got_repository *);
283 /*
284 * Continue an interrupted rebase operation.
285 * This function returns existing references created when rebase was prepared,
286 * and the ID of the commit currently being rebased. This should be called
287 * before either resuming or aborting a rebase operation.
288 * The function also returns a pointer to a fileindex which must be
289 * passed back to other rebase-related functions.
290 */
291 const struct got_error *got_worktree_rebase_continue(struct got_object_id **,
292 struct got_reference **, struct got_reference **, struct got_reference **,
293 struct got_fileindex **, struct got_worktree *, struct got_repository *);
295 /* Check whether a, potentially interrupted, rebase operation is in progress. */
296 const struct got_error *got_worktree_rebase_in_progress(int *,
297 struct got_worktree *);
299 /*
300 * Merge changes from the commit currently being rebased into the work tree.
301 * Report affected files, including merge conflicts, via the specified
302 * progress callback. Also populate a list of affected paths which should
303 * be passed to got_worktree_rebase_commit() after a conflict-free merge.
304 * This list must be initialized with TAILQ_INIT() and disposed of with
305 * got_pathlist_free(list, GOT_PATHLIST_FREE_PATH).
306 */
307 const struct got_error *got_worktree_rebase_merge_files(
308 struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
309 struct got_object_id *, struct got_object_id *, struct got_repository *,
310 got_worktree_checkout_cb, void *, got_cancel_cb, void *);
312 /*
313 * Commit changes merged by got_worktree_rebase_merge_files() to a temporary
314 * branch and return the ID of the newly created commit. An optional list of
315 * merged paths can be provided; otherwise this function will perform a status
316 * crawl across the entire work tree to find paths to commit.
317 */
318 const struct got_error *got_worktree_rebase_commit(struct got_object_id **,
319 struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
320 struct got_reference *, const char *, struct got_commit_object *,
321 struct got_object_id *, int, struct got_repository *);
323 /* Postpone the rebase operation. Should be called after a merge conflict. */
324 const struct got_error *got_worktree_rebase_postpone(struct got_worktree *,
325 struct got_fileindex *);
327 /*
328 * Complete the current rebase operation. This should be called once all
329 * commits have been rebased successfully.
330 * The create_backup parameter controls whether the rebased branch will
331 * be backed up via a reference in refs/got/backup/rebase/.
332 */
333 const struct got_error *got_worktree_rebase_complete(struct got_worktree *,
334 struct got_fileindex *, struct got_reference *, struct got_reference *,
335 struct got_repository *, int create_backup);
337 /*
338 * Abort the current rebase operation.
339 * Report reverted files via the specified progress callback.
340 */
341 const struct got_error *got_worktree_rebase_abort(struct got_worktree *,
342 struct got_fileindex *, struct got_repository *, struct got_reference *,
343 got_worktree_checkout_cb, void *);
345 /*
346 * Prepare for editing the history of the work tree's current branch.
347 * This function creates references to a temporary branch, and the
348 * work tree's current branch, under the "got/worktree/histedit/" namespace.
349 * These references are used to keep track of histedit operation state and
350 * are used as input and/or output arguments with other histedit-related
351 * functions.
352 */
353 const struct got_error *got_worktree_histedit_prepare(struct got_reference **,
354 struct got_reference **, struct got_object_id **, struct got_fileindex **,
355 struct got_worktree *, struct got_repository *);
357 /*
358 * Continue an interrupted histedit operation.
359 * This function returns existing references created when histedit was
360 * prepared and the ID of the commit currently being edited.
361 * It should be called before resuming or aborting a histedit operation.
362 */
363 const struct got_error *got_worktree_histedit_continue(struct got_object_id **,
364 struct got_reference **, struct got_reference **, struct got_object_id **,
365 struct got_fileindex **, struct got_worktree *, struct got_repository *);
367 /* Check whether a histedit operation is in progress. */
368 const struct got_error *got_worktree_histedit_in_progress(int *,
369 struct got_worktree *);
371 /*
372 * Merge changes from the commit currently being edited into the work tree.
373 * Report affected files, including merge conflicts, via the specified
374 * progress callback. Also populate a list of affected paths which should
375 * be passed to got_worktree_histedit_commit() after a conflict-free merge.
376 * This list must be initialized with TAILQ_INIT() and disposed of with
377 * got_pathlist_free(list, GOT_PATHLIST_FREE_PATH).
378 */
379 const struct got_error *got_worktree_histedit_merge_files(
380 struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
381 struct got_object_id *, struct got_object_id *, struct got_repository *,
382 got_worktree_checkout_cb, void *, got_cancel_cb, void *);
384 /*
385 * Commit changes merged by got_worktree_histedit_merge_files() to a temporary
386 * branch and return the ID of the newly created commit. An optional list of
387 * merged paths can be provided; otherwise this function will perform a status
388 * crawl across the entire work tree to find paths to commit.
389 * An optional log message can be provided which will be used instead of the
390 * commit's original message.
391 */
392 const struct got_error *got_worktree_histedit_commit(struct got_object_id **,
393 struct got_pathlist_head *, struct got_worktree *, struct got_fileindex *,
394 struct got_reference *, const char *, struct got_commit_object *,
395 struct got_object_id *, const char *, int, struct got_repository *);
397 /*
398 * Record the specified commit as skipped during histedit.
399 * This should be called for commits which get dropped or get folded into
400 * a subsequent commit.
401 */
402 const struct got_error *got_worktree_histedit_skip_commit(struct got_worktree *,
403 struct got_object_id *, struct got_repository *);
405 /* Postpone the histedit operation. */
406 const struct got_error *got_worktree_histedit_postpone(struct got_worktree *,
407 struct got_fileindex *);
409 /*
410 * Complete the current histedit operation. This should be called once all
411 * commits have been edited successfully.
412 */
413 const struct got_error *got_worktree_histedit_complete(struct got_worktree *,
414 struct got_fileindex *, struct got_reference *, struct got_reference *,
415 struct got_repository *);
417 /*
418 * Abort the current histedit operation.
419 * Report reverted files via the specified progress callback.
420 */
421 const struct got_error *got_worktree_histedit_abort(struct got_worktree *,
422 struct got_fileindex *, struct got_repository *, struct got_reference *,
423 struct got_object_id *, got_worktree_checkout_cb, void *);
425 /* Get the path to this work tree's histedit script file. */
426 const struct got_error *got_worktree_get_histedit_script_path(char **,
427 struct got_worktree *);
429 /*
430 * Prepare a work tree for integrating a branch.
431 * Return pointers to a fileindex and locked references which must be
432 * passed back to other integrate-related functions.
433 */
434 const struct got_error *
435 got_worktree_integrate_prepare(struct got_fileindex **,
436 struct got_reference **, struct got_reference **,
437 struct got_worktree *, const char *, struct got_repository *);
439 /*
440 * Carry out a prepared branch integration operation.
441 * Report affected files via the specified progress callback.
442 */
443 const struct got_error *got_worktree_integrate_continue(
444 struct got_worktree *, struct got_fileindex *, struct got_repository *,
445 struct got_reference *, struct got_reference *,
446 got_worktree_checkout_cb, void *, got_cancel_cb, void *);
448 /* Abort a prepared branch integration operation. */
449 const struct got_error *got_worktree_integrate_abort(struct got_worktree *,
450 struct got_fileindex *, struct got_repository *,
451 struct got_reference *, struct got_reference *);
453 /* Postpone the merge operation. Should be called after a merge conflict. */
454 const struct got_error *got_worktree_merge_postpone(struct got_worktree *,
455 struct got_fileindex *);
457 /* Merge changes from the merge source branch into the worktree. */
458 const struct got_error *
459 got_worktree_merge_branch(struct got_worktree *worktree,
460 struct got_fileindex *fileindex,
461 struct got_object_id *yca_commit_id,
462 struct got_object_id *branch_tip,
463 struct got_repository *repo, got_worktree_checkout_cb progress_cb,
464 void *progress_arg, got_cancel_cb cancel_cb, void *cancel_arg);
466 /* Attempt to commit merged changes. */
467 const struct got_error *
468 got_worktree_merge_commit(struct got_object_id **new_commit_id,
469 struct got_worktree *worktree, struct got_fileindex *fileindex,
470 const char *author, const char *committer, int allow_bad_symlinks,
471 struct got_object_id *branch_tip, const char *branch_name,
472 int allow_conflict, struct got_repository *repo,
473 got_worktree_status_cb status_cb, void *status_arg);
475 /*
476 * Complete the merge operation.
477 * This should be called once changes have been successfully committed.
478 */
479 const struct got_error *got_worktree_merge_complete(
480 struct got_worktree *worktree, struct got_fileindex *fileindex,
481 struct got_repository *repo);
483 /* Check whether a merge operation is in progress. */
484 const struct got_error *got_worktree_merge_in_progress(int *,
485 struct got_worktree *, struct got_repository *);
487 /*
488 * Prepare for merging a branch into the work tree's current branch.
489 * This function creates a reference to the branch being merged, and to
490 * this branch's current tip commit, in the "got/worktree/merge/" namespace.
491 * These references are used to keep track of merge operation state and are
492 * used as input and/or output arguments with other merge-related functions.
493 * The function also returns a pointer to a fileindex which must be
494 * passed back to other merge-related functions.
495 */
496 const struct got_error *got_worktree_merge_prepare(struct got_fileindex **,
497 struct got_worktree *, struct got_reference *, struct got_repository *);
499 /*
500 * Continue an interrupted merge operation.
501 * This function returns name of the branch being merged, and the ID of the
502 * tip commit being merged.
503 * This function should be called before either resuming or aborting a
504 * merge operation.
505 * The function also returns a pointer to a fileindex which must be
506 * passed back to other merge-related functions.
507 */
508 const struct got_error *got_worktree_merge_continue(char **,
509 struct got_object_id **, struct got_fileindex **,
510 struct got_worktree *, struct got_repository *);
512 /*
513 * Abort the current rebase operation.
514 * Report reverted files via the specified progress callback.
515 */
516 const struct got_error *got_worktree_merge_abort(struct got_worktree *,
517 struct got_fileindex *, struct got_repository *,
518 got_worktree_checkout_cb, void *);
520 /*
521 * Stage the specified paths for commit.
522 * If the patch callback is not NULL, call it to select patch hunks for
523 * staging. Otherwise, stage the full file content found at each path.
524 * If a path being staged contains a symlink which points outside
525 * of the path space under version control, raise an error unless
526 * staging of such paths is being forced by the caller.
527 */
528 const struct got_error *got_worktree_stage(struct got_worktree *,
529 struct got_pathlist_head *, got_worktree_status_cb, void *,
530 got_worktree_patch_cb, void *, int, struct got_repository *);
532 /*
533 * Merge staged changes for the specified paths back into the work tree
534 * and mark the paths as non-staged again.
535 */
536 const struct got_error *got_worktree_unstage(struct got_worktree *,
537 struct got_pathlist_head *, got_worktree_checkout_cb, void *,
538 got_worktree_patch_cb, void *, struct got_repository *);
540 /* A callback function which is invoked with per-path info. */
541 typedef const struct got_error *(*got_worktree_path_info_cb)(void *,
542 const char *path, mode_t mode, time_t mtime,
543 struct got_object_id *blob_id, struct got_object_id *staged_blob_id,
544 struct got_object_id *commit_id);
546 /*
547 * Report work-tree meta data for paths in the work tree.
548 * The info callback will be invoked with the provided void * argument,
549 * a path, and meta-data arguments (see got_worktree_path_info_cb).
550 */
551 const struct got_error *
552 got_worktree_path_info(struct got_worktree *, struct got_pathlist_head *,
553 got_worktree_path_info_cb, void *, got_cancel_cb , void *);
555 /* References pointing at pre-rebase commit backups. */
556 #define GOT_WORKTREE_REBASE_BACKUP_REF_PREFIX "refs/got/backup/rebase"
558 /* References pointing at pre-histedit commit backups. */
559 #define GOT_WORKTREE_HISTEDIT_BACKUP_REF_PREFIX "refs/got/backup/histedit"
561 /*
562 * Prepare for applying a patch.
563 */
564 const struct got_error *
565 got_worktree_patch_prepare(struct got_fileindex **, char **,
566 struct got_worktree *);
568 /*
569 * Lookup paths for the "old" and "new" file before patching and check their
570 * status.
571 */
572 const struct got_error *
573 got_worktree_patch_check_path(const char *, const char *, char **, char **,
574 struct got_worktree *, struct got_repository *, struct got_fileindex *);
576 const struct got_error *
577 got_worktree_patch_schedule_add(const char *, struct got_repository *,
578 struct got_worktree *, struct got_fileindex *, got_worktree_checkout_cb,
579 void *);
581 const struct got_error *
582 got_worktree_patch_schedule_rm(const char *, struct got_repository *,
583 struct got_worktree *, struct got_fileindex *, got_worktree_delete_cb,
584 void *);
586 /* Complete the patch operation. */
587 const struct got_error *
588 got_worktree_patch_complete(struct got_fileindex *, const char *);