refs: convert update_ref and refs_update_ref to use struct object_id

Convert update_ref, refs_update_ref, and write_pseudoref to use struct
object_id.  Update the existing callers as well.  Remove update_ref_oid,
as it is no longer needed.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2017-10-15 22:06:51 +00:00
committed by Junio C Hamano
parent 2616a5e508
commit ae077771b0
17 changed files with 65 additions and 74 deletions

View File

@ -233,15 +233,15 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv)
const char *new_sha1_buf = notnull(*argv++, "old-sha1");
const char *old_sha1_buf = notnull(*argv++, "old-sha1");
unsigned int flags = arg_flags(*argv++, "flags");
unsigned char old_sha1[20];
unsigned char new_sha1[20];
struct object_id old_oid;
struct object_id new_oid;
if (get_sha1_hex(old_sha1_buf, old_sha1) ||
get_sha1_hex(new_sha1_buf, new_sha1))
if (get_oid_hex(old_sha1_buf, &old_oid) ||
get_oid_hex(new_sha1_buf, &new_oid))
die("not sha-1");
return refs_update_ref(refs, msg, refname,
new_sha1, old_sha1,
&new_oid, &old_oid,
flags, UPDATE_REFS_DIE_ON_ERR);
}