From: Jeff King
Written-by: Jeff King
Signed-off-by: Karthik Nayak
---
builtin/for-each-ref.c | 40
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 83f9cf9..2721228 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -32,9 +32,9 @@ struct ref_sort {
};
struct refinfo {
- char *refname;
- unsigned char objectname[20];
- int flag;
+ char *name;
+ unsigned char sha1[20];
+ int flags;
const char *symref;
struct atom_value *value;
};
@@ -632,9 +632,9 @@ static void populate_value(struct refinfo *ref)
ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
- if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
+ if (need_symref && (ref->flags & REF_ISSYMREF) && !ref->symref) {
unsigned char unused1[20];
- ref->symref = resolve_refdup(ref->refname, RESOLVE_REF_READING,
+ ref->symref = resolve_refdup(ref->name, RESOLVE_REF_READING,
unused1, NULL);
if (!ref->symref)
ref->symref = "";
@@ -655,14 +655,14 @@ static void populate_value(struct refinfo *ref)
}
if (starts_with(name, "refname"))
- refname = ref->refname;
+ refname = ref->name;
else if (starts_with(name, "symref"))
refname = ref->symref ? ref->symref : "";
else if (starts_with(name, "upstream")) {
/* only local branches may have an upstream */
- if (!starts_with(ref->refname, "refs/heads/"))
+ if (!starts_with(ref->name, "refs/heads/"))
continue;
- branch = branch_get(ref->refname + 11);
+ branch = branch_get(ref->name + 11);
if (!branch || !branch->merge || !branch->merge[0] ||
!branch->merge[0]->dst)
@@ -677,9 +677,9 @@ static void populate_value(struct refinfo *ref)
continue;
} else if (!strcmp(name, "flag")) {
char buf[256], *cp = buf;
- if (ref->flag & REF_ISSYMREF)
+ if (ref->flags & REF_ISSYMREF)
cp = copy_advance(cp, ",symref");
- if (ref->flag & REF_ISPACKED)
+ if (ref->flags & REF_ISPACKED)
cp = copy_advance(cp, ",packed");
if (cp == buf)
v->s = "";
@@ -688,7 +688,7 @@ static void populate_value(struct refinfo *ref)
v->s = xstrdup(buf + 1);
}
continue;
- } else if (!deref && grab_objectname(name, ref->objectname, v))
{
+ } else if (!deref && grab_objectname(name, ref->sha1, v)) {
continue;
} else if (!strcmp(name, "HEAD")) {
const char *head;
@@ -696,7 +696,7 @@ static void populate_value(struct refinfo *ref)
head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
sha1, NULL);
- if (!strcmp(ref->refname, head))
+ if (!strcmp(ref->name, head))
v->s = "*";
else
v->s = " ";
@@ -774,13 +774,13 @@ static void populate_value(struct refinfo *ref)
return;
need_obj:
- buf = get_obj(ref->objectname, &obj, &size, &eaten);
+ buf = get_obj(ref->sha1, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
- sha1_to_hex(ref->objectname), ref->refname);
+ sha1_to_hex(ref->sha1), ref->name);
if (!obj)
die("parse_object_buffer failed on %s for %s",
- sha1_to_hex(ref->objectname), ref->refname);
+ sha1_to_hex(ref->sha1), ref->name);
grab_values(ref->value, 0, obj, buf, size);
if (!eaten)
@@ -808,10 +808,10 @@ static void populate_value(struct refinfo *ref)
buf = get_obj(tagged, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
- sha1_to_hex(tagged), ref->refname);
+ sha1_to_hex(tagged), ref->name);
if (!obj)
die("parse_object_buffer failed on %s for %s",
- sha1_to_hex(tagged), ref->refname);
+ sha1_to_hex(tagged), ref->name);
grab_values(ref->value, 1, obj, buf, size);
if (!eaten)
free(buf);
@@ -877,9 +877,9