refs: update ref transactions to use struct object_id

Update the ref transaction code to use struct object_id.  Remove one
NULL pointer check which was previously inserted around a dereference;
since we now pass a pointer to struct object_id directly through, the
code we're calling handles this for us.

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:53 +00:00
committed by Junio C Hamano
parent 6ee18216d8
commit 89f3bbdd3b
15 changed files with 69 additions and 71 deletions

View File

@ -994,7 +994,7 @@ static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r)
transaction = ref_store_transaction_begin(&refs->base, &err);
if (!transaction ||
ref_transaction_delete(transaction, r->name, r->oid.hash,
ref_transaction_delete(transaction, r->name, &r->oid,
REF_ISPRUNING | REF_NODEREF, NULL, &err) ||
ref_transaction_commit(transaction, &err)) {
ref_transaction_free(transaction);
@ -1079,7 +1079,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
* packed-refs transaction:
*/
if (ref_transaction_update(transaction, iter->refname,
iter->oid->hash, NULL,
iter->oid, NULL,
REF_NODEREF, NULL, &err))
die("failure preparing to create packed reference %s: %s",
iter->refname, err.buf);
@ -2148,7 +2148,7 @@ static int split_head_update(struct ref_update *update,
new_update = ref_transaction_add_update(
transaction, "HEAD",
update->flags | REF_LOG_ONLY | REF_NODEREF,
update->new_oid.hash, update->old_oid.hash,
&update->new_oid, &update->old_oid,
update->msg);
/*
@ -2212,7 +2212,7 @@ static int split_symref_update(struct files_ref_store *refs,
new_update = ref_transaction_add_update(
transaction, referent, new_flags,
update->new_oid.hash, update->old_oid.hash,
&update->new_oid, &update->old_oid,
update->msg);
new_update->parent_update = update;
@ -2594,7 +2594,7 @@ static int files_transaction_prepare(struct ref_store *ref_store,
ref_transaction_add_update(
packed_transaction, update->refname,
update->flags & ~REF_HAVE_OLD,
update->new_oid.hash, update->old_oid.hash,
&update->new_oid, &update->old_oid,
NULL);
}
}
@ -2847,7 +2847,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
*/
ref_transaction_add_update(packed_transaction, update->refname,
update->flags & ~REF_HAVE_OLD,
update->new_oid.hash, update->old_oid.hash,
&update->new_oid, &update->old_oid,
NULL);
}

View File

@ -202,8 +202,8 @@ int ref_update_reject_duplicates(struct string_list *refnames,
struct ref_update *ref_transaction_add_update(
struct ref_transaction *transaction,
const char *refname, unsigned int flags,
const unsigned char *new_sha1,
const unsigned char *old_sha1,
const struct object_id *new_oid,
const struct object_id *old_oid,
const char *msg);
/*