@@ -1816,6 +1816,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
{
struct object *obj;
int i;
+ int ret;
struct object_info empty = OBJECT_INFO_INIT;
CALLOC_ARRAY(ref->value, used_atom_cnt);
@@ -1972,8 +1973,9 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
oi.oid = ref->objectname;
- if (get_object(ref, 0, &obj, &oi, err))
- return -1;
+ ret = get_object(ref, 0, &obj, &oi, err);
+ if (ret)
+ return ret;
/*
* If there is no atom that wants to know about tagged
@@ -2005,8 +2007,10 @@ static int get_ref_atom_value(struct ref_array_item *ref, int atom,
struct atom_value **v, struct strbuf *err)
{
if (!ref->value) {
- if (populate_value(ref, err))
- return -1;
+ int ret = populate_value(ref, err);
+
+ if (ret)
+ return ret;
fill_missing_values(ref->value);
}
*v = &ref->value[atom];
@@ -2580,6 +2584,7 @@ int format_ref_array_item(struct ref_array_item *info,
{
const char *cp, *sp, *ep;
struct ref_formatting_state state = REF_FORMATTING_STATE_INIT;
+ int ret;
state.quote_style = format->quote_style;
push_stack_element(&state.stack);
@@ -2592,10 +2597,10 @@ int format_ref_array_item(struct ref_array_item *info,
if (cp < sp)
append_literal(cp, sp, &state);
pos = parse_ref_filter_atom(format, sp + 2, ep, error_buf);
- if (pos < 0 || get_ref_atom_value(info, pos, &atomv, error_buf) ||
+ if (pos < 0 || (ret = get_ref_atom_value(info, pos, &atomv, error_buf)) ||
atomv->handler(atomv, &state, error_buf)) {
pop_stack_element(&state.stack);
- return -1;
+ return ret ? ret : -1;
}
}
if (*cp) {