Merge branch 'jk/alternate-ref-optim' into maint
[gitweb.git] / refs / refs-internal.h
index f20dde39ee606488f5a479bbda6bfa2042ae2990..3d46131efbcc0a76cc3054a97a669bc5bdd036e7 100644 (file)
@@ -111,28 +111,6 @@ enum peel_status {
  */
 enum peel_status peel_object(const unsigned char *name, unsigned char *sha1);
 
-/*
- * Return 0 if a reference named refname could be created without
- * conflicting with the name of an existing reference. Otherwise,
- * return a negative value and write an explanation to err. If extras
- * is non-NULL, it is a list of additional refnames with which refname
- * is not allowed to conflict. If skip is non-NULL, ignore potential
- * conflicts with refs in skip (e.g., because they are scheduled for
- * deletion in the same operation). Behavior is undefined if the same
- * name is listed in both extras and skip.
- *
- * Two reference names conflict if one of them exactly matches the
- * leading components of the other; e.g., "foo/bar" conflicts with
- * both "foo" and with "foo/bar/baz" but not with "foo/bar" or
- * "foo/barbados".
- *
- * extras and skip must be sorted.
- */
-int verify_refname_available(const char *newname,
-                            const struct string_list *extras,
-                            const struct string_list *skip,
-                            struct strbuf *err);
-
 /*
  * Copy the reflog message msg to buf, which has been allocated sufficiently
  * large, while cleaning up the whitespaces.  Especially, convert LF to space,
@@ -187,6 +165,10 @@ struct ref_update {
        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
@@ -222,6 +204,7 @@ enum ref_transaction_state {
  * as atomically as possible.  This structure is opaque to callers.
  */
 struct ref_transaction {
+       struct ref_store *ref_store;
        struct ref_update **updates;
        size_t alloc;
        size_t nr;
@@ -252,7 +235,9 @@ const char *find_descendant_ref(const char *dirname,
  * processes (though rename_ref() catches some races that might get by
  * this check).
  */
-int rename_ref_available(const char *old_refname, const char *new_refname);
+int refs_rename_ref_available(struct ref_store *refs,
+                             const char *old_refname,
+                             const char *new_refname);
 
 /* We allow "recursive" symbolic refs. Only within reason, though */
 #define SYMREF_MAXDEPTH 5
@@ -350,6 +335,17 @@ struct ref_iterator *empty_ref_iterator_begin(void);
  */
 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
@@ -594,12 +590,6 @@ typedef int read_raw_ref_fn(struct ref_store *ref_store,
                            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;
@@ -616,7 +606,6 @@ struct ref_storage_be {
 
        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;
@@ -646,9 +635,4 @@ struct ref_store {
 void base_ref_store_init(struct ref_store *refs,
                         const struct ref_storage_be *be);
 
-const char *resolve_ref_recursively(struct ref_store *refs,
-                                   const char *refname,
-                                   int resolve_flags,
-                                   unsigned char *sha1, int *flags);
-
 #endif /* REFS_REFS_INTERNAL_H */