18 lines
719 B
Markdown
18 lines
719 B
Markdown
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_internal` will return the ref name
|
|
and value.
|
|
- When given a symbolic ref, `_get_ref_internal` will 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`.
|