]> git.ipfire.org Git - thirdparty/git.git/commit - refs.c
refs: store references hierarchically
authorMichael Haggerty <mhagger@alum.mit.edu>
Tue, 10 Apr 2012 05:30:26 +0000 (07:30 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Apr 2012 22:55:55 +0000 (15:55 -0700)
commit432ad41e60cedb87ceec446ab034d46a53f5f9d8
treeecad7dc0dded731e655867fb86e1a5b41cac865b
parent81a79d8e27f6dd5908ae9ba122833574b7475151
refs: store references hierarchically

Store references hierarchically in a tree that matches the
pseudo-directory structure of the reference names.  Add a new kind of
ref_entry (with flag REF_DIR) to represent a whole subdirectory of
references.  Sort ref_dirs one subdirectory at a time.

NOTE: the dirs can now be sorted as a side-effect of other function
calls.  Therefore, it would be problematic to do something from a
each_ref_fn callback that could provoke the sorting of a directory
that is currently being iterated over (i.e., the directory containing
the entry that is being processed or any of its parents).

This is a bit far-fetched, because a directory is always sorted just
before being iterated over.  Therefore, read-only accesses cannot
trigger the sorting of a directory whose iteration has already
started.  But if a callback function would add a reference to a parent
directory of the reference in the iteration, then try to resolve a
reference under that directory, a re-sort could be triggered and cause
the iteration to work incorrectly.

Nevertheless...add a comment in refs.h warning against modifications
during iteration.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs.h