refs: add ref_type function
[gitweb.git] / refs.h
diff --git a/refs.h b/refs.h
index 6d7d9b40f318119eea1e3240cca3a96d2c64e2a6..1927bda993da81d0d5a7011ff7b15fb8d4f62d92 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -67,7 +67,7 @@ struct ref_transaction;
  * single callback invocation.
  */
 typedef int each_ref_fn(const char *refname,
-                       const unsigned char *sha1, int flags, void *cb_data);
+                       const struct object_id *oid, int flags, void *cb_data);
 
 /*
  * The following functions invoke the specified callback function for
@@ -187,11 +187,12 @@ extern int peel_ref(const char *refname, unsigned char *sha1);
  * Other flags are reserved for internal use.
  */
 #define REF_NODEREF    0x01
+#define REF_FORCE_CREATE_REFLOG 0x40
 
 /*
- * Setup reflog before using. Set errno to something meaningful on failure.
+ * Setup reflog before using. Fill in err and return -1 on failure.
  */
-int log_ref_setup(const char *refname, struct strbuf *logfile);
+int safe_create_reflog(const char *refname, int force_create, struct strbuf *err);
 
 /** Reads log for the value of ref during at_time. **/
 extern int read_ref_at(const char *refname, unsigned int flags,
@@ -379,6 +380,14 @@ int update_ref(const char *msg, const char *refname,
 extern int parse_hide_refs_config(const char *var, const char *value, const char *);
 extern int ref_is_hidden(const char *);
 
+enum ref_type {
+       REF_TYPE_PER_WORKTREE,
+       REF_TYPE_PSEUDOREF,
+       REF_TYPE_NORMAL,
+};
+
+enum ref_type ref_type(const char *refname);
+
 enum expire_reflog_flags {
        EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
        EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,