Files
DIY_GIT_in_Python/how_to/Change_33.md

719 B
Raw Blame History

data: Dereference refs when reading and writing

Now well dereference symbolic refs not only when reading them but also when writing them.

Well 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, well use _get_ref_internal in get_ref.