diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2013-04-22 21:52:12 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-01 15:33:09 -0700 |
commit | 7d76fdc8299639096ace153aef0f0b96dcc5b308 (patch) | |
tree | 31eab58a7c3d1d82298f3fd5f8ccbcb955b060cd | |
parent | refs: document do_for_each_ref() and do_one_ref() (diff) | |
download | tgif-7d76fdc8299639096ace153aef0f0b96dcc5b308.tar.xz |
refs: document how current_ref is used
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -529,6 +529,15 @@ static void sort_ref_dir(struct ref_dir *dir) /* Include broken references in a do_for_each_ref*() iteration: */ #define DO_FOR_EACH_INCLUDE_BROKEN 0x01 +/* + * current_ref is a performance hack: when iterating over references + * using the for_each_ref*() functions, current_ref is set to the + * current reference's entry before calling the callback function. If + * the callback function calls peel_ref(), then peel_ref() first + * checks whether the reference to be peeled is the current reference + * (it usually is) and if so, returns that reference's peeled version + * if it is available. This avoids a refname lookup in a common case. + */ static struct ref_entry *current_ref; /* |