refs: standardize output of refs_read_symbolic_ref
When the symbolic reference we want to read with refs_read_symbolic_ref is actually not a symbolic reference, the files and the reftable backends return different values (1 and -1 respectively). Standardize the returned values so that 0 is success, -1 is a generic error and -2 is that the reference was actually non-symbolic. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
2fd5555895
commit
8102d10ff8
@@ -830,10 +830,12 @@ static int reftable_be_read_symbolic_ref(struct ref_store *ref_store,
|
||||
return ret;
|
||||
|
||||
ret = reftable_stack_read_ref(stack, refname, &ref);
|
||||
if (ret == 0 && ref.value_type == REFTABLE_REF_SYMREF)
|
||||
if (ret)
|
||||
ret = -1;
|
||||
else if (ref.value_type == REFTABLE_REF_SYMREF)
|
||||
strbuf_addstr(referent, ref.value.symref);
|
||||
else
|
||||
ret = -1;
|
||||
ret = NOT_A_SYMREF;
|
||||
|
||||
reftable_ref_record_release(&ref);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user