* [PATCH] free_ref_entry(): do not trigger reading of loose refs
@ 2012-05-20 6:49 mhagger
0 siblings, 0 replies; only message in thread
From: mhagger @ 2012-05-20 6:49 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King, Michael Haggerty
From: Michael Haggerty <mhagger@alum.mit.edu>
Do not call get_ref_dir() from within free_ref_entry(), because that
triggers the reading of loose refs, only for them to be freed
immediately.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Fix a silly inefficiency from the lazy-loose changes.
refs.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c
index d6bdb47..26c8fcd 100644
--- a/refs.c
+++ b/refs.c
@@ -259,8 +259,13 @@ static void clear_ref_dir(struct ref_dir *dir);
static void free_ref_entry(struct ref_entry *entry)
{
- if (entry->flag & REF_DIR)
- clear_ref_dir(get_ref_dir(entry));
+ if (entry->flag & REF_DIR) {
+ /*
+ * Do not use get_ref_dir() here, as that might
+ * trigger the reading of loose refs.
+ */
+ clear_ref_dir(&entry->u.subdir);
+ }
free(entry);
}
--
1.7.10
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-05-20 6:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-20 6:49 [PATCH] free_ref_entry(): do not trigger reading of loose refs mhagger
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).