/*
* If (flags & REF_HAVE_NEW), set the reference to this value:
*/
- unsigned char new_sha1[20];
+ struct object_id new_oid;
/*
* If (flags & REF_HAVE_OLD), check that the reference
* previously had this value:
*/
- unsigned char old_sha1[20];
+ struct object_id old_oid;
/*
* One or more of REF_HAVE_NEW, REF_HAVE_OLD, REF_NODEREF,
const char refname[FLEX_ARRAY];
};
+int refs_read_raw_ref(struct ref_store *ref_store,
+ const char *refname, unsigned char *sha1,
+ struct strbuf *referent, unsigned int *type);
+
/*
* Add a ref_update with the specified properties to transaction, and
* return a pointer to the new object. This function does not verify
*/
int is_empty_ref_iterator(struct ref_iterator *ref_iterator);
+/*
+ * Return an iterator that goes over each reference in `refs` for
+ * which the refname begins with prefix. If trim is non-zero, then
+ * trim that many characters off the beginning of each refname. flags
+ * can be DO_FOR_EACH_INCLUDE_BROKEN to include broken references in
+ * the iteration.
+ */
+struct ref_iterator *refs_ref_iterator_begin(
+ struct ref_store *refs,
+ const char *prefix, int trim, int flags);
+
/*
* A callback function used to instruct merge_ref_iterator how to
* interleave the entries from iter0 and iter1. The function should
#define REF_STORE_WRITE (1 << 1) /* can perform update operations */
#define REF_STORE_ODB (1 << 2) /* has access to object database */
#define REF_STORE_MAIN (1 << 3)
+#define REF_STORE_ALL_CAPS (REF_STORE_READ | \
+ REF_STORE_WRITE | \
+ REF_STORE_ODB | \
+ REF_STORE_MAIN)
/*
* Initialize the ref_store for the specified gitdir. These functions
const char *refname, unsigned char *sha1,
struct strbuf *referent, unsigned int *type);
-typedef int verify_refname_available_fn(struct ref_store *ref_store,
- const char *newname,
- const struct string_list *extras,
- const struct string_list *skip,
- struct strbuf *err);
-
struct ref_storage_be {
struct ref_storage_be *next;
const char *name;
ref_iterator_begin_fn *iterator_begin;
read_raw_ref_fn *read_raw_ref;
- verify_refname_available_fn *verify_refname_available;
reflog_iterator_begin_fn *reflog_iterator_begin;
for_each_reflog_ent_fn *for_each_reflog_ent;