Merge branch 'ab/object-file-api-updates'
Object-file API shuffling. * ab/object-file-api-updates: object-file API: pass an enum to read_object_with_reference() object-file.c: add a literal version of write_object_file_prepare() object-file API: have hash_object_file() take "enum object_type" object API: rename hash_object_file_literally() to write_*() object-file API: split up and simplify check_object_signature() object API users + docs: check <0, not !0 with check_object_signature() object API docs: move check_object_signature() docs to cache.h object API: correct "buf" v.s. "map" mismatch in *.c and *.h object-file API: have write_object_file() take "enum object_type" object-file API: add a format_object_header() function object-file API: return "void", not "int" from hash_object_file() object-file.c: split up declaration of unrelated variables
This commit is contained in:
12
apply.c
12
apply.c
@ -3164,7 +3164,7 @@ static int apply_binary(struct apply_state *state,
|
||||
* See if the old one matches what the patch
|
||||
* applies to.
|
||||
*/
|
||||
hash_object_file(the_hash_algo, img->buf, img->len, blob_type,
|
||||
hash_object_file(the_hash_algo, img->buf, img->len, OBJ_BLOB,
|
||||
&oid);
|
||||
if (strcmp(oid_to_hex(&oid), patch->old_oid_prefix))
|
||||
return error(_("the patch applies to '%s' (%s), "
|
||||
@ -3210,7 +3210,7 @@ static int apply_binary(struct apply_state *state,
|
||||
name);
|
||||
|
||||
/* verify that the result matches */
|
||||
hash_object_file(the_hash_algo, img->buf, img->len, blob_type,
|
||||
hash_object_file(the_hash_algo, img->buf, img->len, OBJ_BLOB,
|
||||
&oid);
|
||||
if (strcmp(oid_to_hex(&oid), patch->new_oid_prefix))
|
||||
return error(_("binary patch to '%s' creates incorrect result (expecting %s, got %s)"),
|
||||
@ -3599,7 +3599,7 @@ static int try_threeway(struct apply_state *state,
|
||||
|
||||
/* Preimage the patch was prepared for */
|
||||
if (patch->is_new)
|
||||
write_object_file("", 0, blob_type, &pre_oid);
|
||||
write_object_file("", 0, OBJ_BLOB, &pre_oid);
|
||||
else if (get_oid(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."));
|
||||
@ -3615,7 +3615,7 @@ static int try_threeway(struct apply_state *state,
|
||||
return -1;
|
||||
}
|
||||
/* post_oid is theirs */
|
||||
write_object_file(tmp_image.buf, tmp_image.len, blob_type, &post_oid);
|
||||
write_object_file(tmp_image.buf, tmp_image.len, OBJ_BLOB, &post_oid);
|
||||
clear_image(&tmp_image);
|
||||
|
||||
/* our_oid is ours */
|
||||
@ -3628,7 +3628,7 @@ static int try_threeway(struct apply_state *state,
|
||||
return error(_("cannot read the current contents of '%s'"),
|
||||
patch->old_name);
|
||||
}
|
||||
write_object_file(tmp_image.buf, tmp_image.len, blob_type, &our_oid);
|
||||
write_object_file(tmp_image.buf, tmp_image.len, OBJ_BLOB, &our_oid);
|
||||
clear_image(&tmp_image);
|
||||
|
||||
/* in-core three-way merge between post and our using pre as base */
|
||||
@ -4328,7 +4328,7 @@ static int add_index_file(struct apply_state *state,
|
||||
}
|
||||
fill_stat_cache_info(state->repo->index, ce, &st);
|
||||
}
|
||||
if (write_object_file(buf, size, blob_type, &ce->oid) < 0) {
|
||||
if (write_object_file(buf, size, OBJ_BLOB, &ce->oid) < 0) {
|
||||
discard_cache_entry(ce);
|
||||
return error(_("unable to create backing store "
|
||||
"for newly created file %s"), path);
|
||||
|
Reference in New Issue
Block a user