libgit2/libgit2 — pull request #472 by tanoku (2011-11-06 02:24:00+00:00)
Title: References! References! References!

Sorry this took so long! The rewrite was bigger than what I expected. This is based off @schu's changes, but very few of them remain.

> This new version of the references code is significantly faster and
> hopefully easier to read.

> External API stays the same. A new method `git_reference_reload()` has
> been added to force updating a memory reference from disk. In-memory
> references are no longer updated automagically -- this was killing us.

> If a reference is deleted externally and the user doesn't reload the
> memory object, nothing critical happens: any functions using that
> reference should fail gracefully (e.g. deletion, renaming, and so on).

> All generated references from the API are read only and must be free'd
> by the user. There is no reference counting and no traces of generated
> references are kept in the library.

> There is no longer an internal representation for references. There is
> only one reference struct `git_reference`, and symbolic/oid targets are
> stored inside an union.

> Packfile references are stored using an optimized struct with flex array
> for reference names. This should significantly reduce the memory cost of
> loading the packfile from disk.

Testers gonna test. DO IT.