unsigned int length;
} objectname;
struct refname_atom refname;
+ char *head;
} u;
} *used_atom;
static int used_atom_cnt, need_tagged, need_symref;
static void refname_atom_parser(struct used_atom *atom, const char *arg)
{
- return refname_atom_parser_internal(&atom->u.refname, arg, atom->name);
+ refname_atom_parser_internal(&atom->u.refname, arg, atom->name);
}
static align_type parse_align_position(const char *s)
}
}
+static void head_atom_parser(struct used_atom *atom, const char *arg)
+{
+ unsigned char unused[GIT_SHA1_RAWSZ];
+
+ atom->u.head = resolve_refdup("HEAD", RESOLVE_REF_READING, unused, NULL);
+}
static struct {
const char *name;
{ "push", FIELD_STR, remote_ref_atom_parser },
{ "symref", FIELD_STR, refname_atom_parser },
{ "flag" },
- { "HEAD" },
+ { "HEAD", FIELD_STR, head_atom_parser },
{ "color", FIELD_STR, color_atom_parser },
{ "align", FIELD_STR, align_atom_parser },
{ "end" },
} else if (!deref && grab_objectname(name, ref->objectname, v, atom)) {
continue;
} else if (!strcmp(name, "HEAD")) {
- const char *head;
- unsigned char sha1[20];
-
- head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
- sha1, NULL);
- if (head && !strcmp(ref->refname, head))
+ if (atom->u.head && !strcmp(ref->refname, atom->u.head))
v->s = "*";
else
v->s = " ";