diff options
Diffstat (limited to 'apply.c')
| -rw-r--r-- | apply.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -8,12 +8,17 @@ */ #include "cache.h" +#include "abspath.h" +#include "alloc.h" #include "config.h" #include "object-store.h" #include "blob.h" #include "delta.h" #include "diff.h" #include "dir.h" +#include "environment.h" +#include "gettext.h" +#include "hex.h" #include "xdiff-interface.h" #include "ll-merge.h" #include "lockfile.h" @@ -22,6 +27,8 @@ #include "rerere.h" #include "apply.h" #include "entry.h" +#include "setup.h" +#include "wrapper.h" struct gitdiff_data { struct strbuf *root; @@ -3201,7 +3208,8 @@ static int apply_binary(struct apply_state *state, unsigned long size; char *result; - result = read_object_file(&oid, &type, &size); + result = repo_read_object_file(the_repository, &oid, &type, + &size); if (!result) return error(_("the necessary postimage %s for " "'%s' cannot be read"), @@ -3264,7 +3272,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns unsigned long sz; char *result; - result = read_object_file(oid, &type, &sz); + result = repo_read_object_file(the_repository, oid, &type, + &sz); if (!result) return -1; /* XXX read_sha1_file NUL-terminates */ @@ -3492,7 +3501,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id) clear_image(image); - image->buf = read_object_file(result_id, &type, &size); + image->buf = repo_read_object_file(the_repository, result_id, &type, + &size); if (!image->buf || type != OBJ_BLOB) die("unable to read blob object %s", oid_to_hex(result_id)); image->len = size; @@ -3610,7 +3620,7 @@ static int try_threeway(struct apply_state *state, /* Preimage the patch was prepared for */ if (patch->is_new) write_object_file("", 0, OBJ_BLOB, &pre_oid); - else if (get_oid(patch->old_oid_prefix, &pre_oid) || + else if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) || read_blob_object(&buf, &pre_oid, patch->old_mode)) return error(_("repository lacks the necessary blob to perform 3-way merge.")); @@ -4105,7 +4115,7 @@ static int preimage_oid_in_gitlink_patch(struct patch *p, struct object_id *oid) static int build_fake_ancestor(struct apply_state *state, struct patch *list) { struct patch *patch; - struct index_state result = { NULL }; + struct index_state result = INDEX_STATE_INIT(state->repo); struct lock_file lock = LOCK_INIT; int res; @@ -4127,7 +4137,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list) else return error(_("sha1 information is lacking or " "useless for submodule %s"), name); - } else if (!get_oid_blob(patch->old_oid_prefix, &oid)) { + } else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) { ; /* ok */ } else if (!patch->lines_added && !patch->lines_deleted) { /* mode-only change: update the current */ |
