Blame


1 069bbb86 2022-03-07 thomas /*
2 069bbb86 2022-03-07 thomas * Copyright (c) 2022 Omar Polo <op@openbsd.org>
3 069bbb86 2022-03-07 thomas *
4 069bbb86 2022-03-07 thomas * Permission to use, copy, modify, and distribute this software for any
5 069bbb86 2022-03-07 thomas * purpose with or without fee is hereby granted, provided that the above
6 069bbb86 2022-03-07 thomas * copyright notice and this permission notice appear in all copies.
7 069bbb86 2022-03-07 thomas *
8 069bbb86 2022-03-07 thomas * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 069bbb86 2022-03-07 thomas * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 069bbb86 2022-03-07 thomas * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 069bbb86 2022-03-07 thomas * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 069bbb86 2022-03-07 thomas * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 069bbb86 2022-03-07 thomas * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 069bbb86 2022-03-07 thomas * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 069bbb86 2022-03-07 thomas */
16 069bbb86 2022-03-07 thomas
17 069bbb86 2022-03-07 thomas /*
18 c71da4f7 2022-03-22 thomas * A callback that gets invoked during the patch application.
19 c71da4f7 2022-03-22 thomas *
20 49114f01 2022-03-22 thomas * Receives the old and new path, a status code, if an error occurred while
21 49114f01 2022-03-22 thomas * applying the patch, and a hunk applied with offset or its error.
22 c71da4f7 2022-03-22 thomas */
23 c71da4f7 2022-03-22 thomas typedef const struct got_error *(*got_patch_progress_cb)(void *,
24 49114f01 2022-03-22 thomas const char *, const char *, unsigned char, const struct got_error *,
25 fd8b4acb 2022-07-03 thomas int, int, int, int, int, int, const struct got_error *);
26 c71da4f7 2022-03-22 thomas
27 c71da4f7 2022-03-22 thomas /*
28 069bbb86 2022-03-07 thomas * Apply the (already opened) patch to the repository and register the
29 069bbb86 2022-03-07 thomas * status of the added and removed files.
30 069bbb86 2022-03-07 thomas *
31 069bbb86 2022-03-07 thomas * The patch file descriptor *must* be seekable.
32 069bbb86 2022-03-07 thomas */
33 069bbb86 2022-03-07 thomas const struct got_error *
34 d9db2ff9 2022-04-16 thomas got_patch(int, struct got_worktree *, struct got_repository *, int, int,
35 7d8bcb99 2022-07-28 thomas int, struct got_object_id *, got_patch_progress_cb, void *,
36 7d8bcb99 2022-07-28 thomas got_cancel_cb, void *);