719 B
719 B
data: Dereference refs when reading and writing
Now we’ll dereference symbolic refs not only when reading them but also when writing them.
We’ll implement a helper function called
_get_ref_internal which will return the path and the value
of the last ref pointed by a symbolic ref. In simple words:
- When given a non-symbolic ref,
_get_ref_internalwill return the ref name and value. - When given a symbolic ref,
_get_ref_internalwill dereference the ref recursively, and then return the name of the last (non-symbolic) ref that points to an OID, plus its value.
Now update_ref will use _get_ref_internal
to know which ref it needs to update.
Additionally, we’ll use _get_ref_internal in
get_ref.