0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 4, 4
};
+/*
+ * Flag passed to lock_ref_sha1_basic() telling it to tolerate broken
+ * refs (i.e., because the reference is about to be deleted anyway).
+ */
+#define REF_DELETING 0x02
+
/*
* Used as a flag to ref_transaction_delete when a loose ref is being
* pruned.
*/
-#define REF_ISPRUNING 0x0100
+#define REF_ISPRUNING 0x04
+
/*
* Try to read one refname component from the front of refname.
* Return the length of the component found, or -1 if the component is
static struct ref_lock *lock_ref_sha1_basic(const char *refname,
const unsigned char *old_sha1,
const struct string_list *skip,
- int flags, int *type_p)
+ unsigned int flags, int *type_p)
{
char *ref_file;
const char *orig_refname = refname;
return 0;
}
-int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
+int delete_ref(const char *refname, const unsigned char *sha1, unsigned int flags)
{
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
transaction = ref_transaction_begin(&err);
if (!transaction ||
- ref_transaction_delete(transaction, refname, sha1, delopt,
+ ref_transaction_delete(transaction, refname, sha1, flags,
sha1 && !is_null_sha1(sha1), NULL, &err) ||
ref_transaction_commit(transaction, &err)) {
error("%s", err.buf);
struct ref_update {
unsigned char new_sha1[20];
unsigned char old_sha1[20];
- int flags; /* REF_NODEREF? */
+ unsigned int flags; /* REF_NODEREF? */
int have_old; /* 1 if old_sha1 is valid, 0 otherwise */
struct ref_lock *lock;
int type;
const char *refname,
const unsigned char *new_sha1,
const unsigned char *old_sha1,
- int flags, int have_old, const char *msg,
+ unsigned int flags, int have_old, const char *msg,
struct strbuf *err)
{
struct ref_update *update;
int ref_transaction_create(struct ref_transaction *transaction,
const char *refname,
const unsigned char *new_sha1,
- int flags, const char *msg,
+ unsigned int flags, const char *msg,
struct strbuf *err)
{
return ref_transaction_update(transaction, refname, new_sha1,
int ref_transaction_delete(struct ref_transaction *transaction,
const char *refname,
const unsigned char *old_sha1,
- int flags, int have_old, const char *msg,
+ unsigned int flags, int have_old, const char *msg,
struct strbuf *err)
{
return ref_transaction_update(transaction, refname, null_sha1,
int update_ref(const char *action, const char *refname,
const unsigned char *sha1, const unsigned char *oldval,
- int flags, enum action_on_err onerr)
+ unsigned int flags, enum action_on_err onerr)
{
struct ref_transaction *t;
struct strbuf err = STRBUF_INIT;
/* Acquire all locks while verifying old values */
for (i = 0; i < n; i++) {
struct ref_update *update = updates[i];
- int flags = update->flags;
+ unsigned int flags = update->flags;
if (is_null_sha1(update->new_sha1))
flags |= REF_DELETING;