summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-10-15 22:06:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-16 02:05:50 (GMT)
commit89f3bbdd3b1f46a5747aa5618b7742f7b3f2adef (patch)
treee8345a55653b4f286a86bde54f44244b4fcc2201 /refs
parent6ee18216d8d9ca8f76b01282b36bdf590a64d8fc (diff)
downloadgit-89f3bbdd3b1f46a5747aa5618b7742f7b3f2adef.zip
git-89f3bbdd3b1f46a5747aa5618b7742f7b3f2adef.tar.gz
git-89f3bbdd3b1f46a5747aa5618b7742f7b3f2adef.tar.bz2
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>
Diffstat (limited to 'refs')
-rw-r--r--refs/files-backend.c12
-rw-r--r--refs/refs-internal.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 9c4766a..8ab0a7a 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -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);
}
diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index 448de4b..951bd34 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -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);
/*