]> git.ipfire.org Git - thirdparty/git.git/blobdiff - refs.c
refs: update some more docs to use "oid" rather than "sha1"
[thirdparty/git.git] / refs.c
diff --git a/refs.c b/refs.c
index 6546346b6ab90c58f1f92a2196d6f1c71055a75a..339d4318ee4500ffeb26426bdf9976979ecf739a 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -770,7 +770,7 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
                if (cb->cutoff_cnt)
                        *cb->cutoff_cnt = cb->reccnt - 1;
                /*
-                * we have not yet updated cb->[n|o]sha1 so they still
+                * we have not yet updated cb->[n|o]oid so they still
                 * hold the values for the previous record.
                 */
                if (!is_null_oid(&cb->ooid)) {
@@ -906,9 +906,6 @@ struct ref_update *ref_transaction_add_update(
        if (transaction->state != REF_TRANSACTION_OPEN)
                die("BUG: update called for transaction that is not open");
 
-       if ((flags & REF_ISPRUNING) && !(flags & REF_NODEREF))
-               die("BUG: REF_ISPRUNING set without REF_NODEREF");
-
        FLEX_ALLOC_STR(update, refname, refname);
        ALLOC_GROW(transaction->updates, transaction->nr + 1, transaction->alloc);
        transaction->updates[transaction->nr++] = update;
@@ -940,7 +937,8 @@ int ref_transaction_update(struct ref_transaction *transaction,
                return -1;
        }
 
-       flags &= REF_TRANSACTION_UPDATE_ALLOWED_FLAGS;
+       if (flags & ~REF_TRANSACTION_UPDATE_ALLOWED_FLAGS)
+               BUG("illegal flags 0x%x passed to ref_transaction_update()", flags);
 
        flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
 
@@ -1382,10 +1380,10 @@ int for_each_rawref(each_ref_fn fn, void *cb_data)
 }
 
 int refs_read_raw_ref(struct ref_store *ref_store,
-                     const char *refname, unsigned char *sha1,
+                     const char *refname, struct object_id *oid,
                      struct strbuf *referent, unsigned int *type)
 {
-       return ref_store->be->read_raw_ref(ref_store, refname, sha1, referent, type);
+       return ref_store->be->read_raw_ref(ref_store, refname, oid, referent, type);
 }
 
 /* This function needs to return a meaningful errno on failure */
@@ -1428,7 +1426,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
                unsigned int read_flags = 0;
 
                if (refs_read_raw_ref(refs, refname,
-                                     oid->hash, &sb_refname, &read_flags)) {
+                                     oid, &sb_refname, &read_flags)) {
                        *flags |= read_flags;
 
                        /* In reading mode, refs must eventually resolve */
@@ -1879,7 +1877,7 @@ int refs_verify_refname_available(struct ref_store *refs,
                if (skip && string_list_has_string(skip, dirname.buf))
                        continue;
 
-               if (!refs_read_raw_ref(refs, dirname.buf, oid.hash, &referent, &type)) {
+               if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent, &type)) {
                        strbuf_addf(err, "'%s' exists; cannot create '%s'",
                                    dirname.buf, refname);
                        goto cleanup;