2 * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
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.
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.
17 #include <sys/queue.h>
25 #include "got_error.h"
26 #include "got_repository.h"
27 #include "got_object.h"
32 got_delta_open(const char *path_packfile, int type, off_t offset,
35 struct got_delta *delta;
37 delta = calloc(1, sizeof(*delta));
41 delta->path_packfile = strdup(path_packfile);
42 if (delta->path_packfile == NULL) {
47 delta->offset = offset;
53 got_delta_close(struct got_delta *delta)
55 free(delta->path_packfile);
60 const struct got_error *
61 got_delta_chain_get_base_type(int *type, struct got_delta_chain *deltas)
63 struct got_delta *delta;
65 /* The first delta in the chain should represent the base object. */
66 delta = SIMPLEQ_FIRST(&deltas->entries);
67 if (delta->type == GOT_OBJ_TYPE_COMMIT ||
68 delta->type == GOT_OBJ_TYPE_TREE ||
69 delta->type == GOT_OBJ_TYPE_BLOB ||
70 delta->type == GOT_OBJ_TYPE_TAG) {
75 return got_error(GOT_ERR_BAD_DELTA_CHAIN);
78 const struct got_error *got_delta_apply(struct got_delta *delta,
79 FILE *base_file, FILE *delta_file, FILE *outfile)
81 return got_error(GOT_ERR_NOT_IMPL);