int ret = 0;
int remote_branch = 0;
struct strbuf bname = STRBUF_INIT;
- unsigned allowed_interpret;
+ enum interpret_branch_kind allowed_interpret;
struct string_list refs_to_delete = STRING_LIST_INIT_DUP;
struct string_list_item *item;
int branch_name_pos;
static int reinterpret(struct repository *r,
const char *name, int namelen, int len,
- struct strbuf *buf, unsigned allowed)
+ struct strbuf *buf,
+ enum interpret_branch_kind allowed)
{
/* we have extra data, which might need further processing */
struct strbuf tmp = STRBUF_INIT;
free(s);
}
-static int branch_interpret_allowed(const char *refname, unsigned allowed)
+static int branch_interpret_allowed(const char *refname,
+ enum interpret_branch_kind allowed)
{
if (!allowed)
return 1;
* If the input was ok but there are not N branch switches in the
* reflog, it returns 0.
*/
-#define INTERPRET_BRANCH_LOCAL (1<<0)
-#define INTERPRET_BRANCH_REMOTE (1<<1)
-#define INTERPRET_BRANCH_HEAD (1<<2)
+enum interpret_branch_kind {
+ INTERPRET_BRANCH_LOCAL = (1 << 0),
+ INTERPRET_BRANCH_REMOTE = (1 << 1),
+ INTERPRET_BRANCH_HEAD = (1 << 2),
+};
+
struct interpret_branch_name_options {
/*
* If "allowed" is non-zero, it is a treated as a bitfield of allowable
* ("refs/remotes/"), or "HEAD". If no "allowed" bits are set, any expansion is
* allowed, even ones to refs outside of those namespaces.
*/
- unsigned allowed;
+ enum interpret_branch_kind allowed;
/*
* If ^{upstream} or ^{push} (or equivalent) is requested, and the
return NULL;
}
-void copy_branchname(struct strbuf *sb, const char *name, unsigned allowed)
+void copy_branchname(struct strbuf *sb, const char *name,
+ enum interpret_branch_kind allowed)
{
int len = strlen(name);
struct interpret_branch_name_options options = {
#ifndef REFS_H
#define REFS_H
+#include "object-name.h"
#include "commit.h"
#include "repository.h"
#include "repo-settings.h"
* repo_interpret_branch_name() for details.
*/
void copy_branchname(struct strbuf *sb, const char *name,
- unsigned allowed);
+ enum interpret_branch_kind allowed);
/*
* Like copy_branchname() above, but confirm that the result is