{"thread":{"id":"30568","subject":"[PATCH] free_ref_entry(): do not trigger reading of loose refs","startedAt":"2012-05-20T06:49:32Z","lastAt":"2012-05-20T06:49:32Z","messageCount":1,"participants":["mhagger@alum.mit.edu"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"191754","messageId":"1337496572-11258-1-git-send-email-mhagger@alum.mit.edu","threadId":"30568","inReplyTo":null,"subject":"[PATCH] free_ref_entry(): do not trigger reading of loose refs","fromName":"","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-05-20T06:49:32Z","receivedAt":"2012-05-20T06:49:32Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"From: Michael Haggerty <mhagger@alum.mit.edu>\n\nDo not call get_ref_dir() from within free_ref_entry(), because that\ntriggers the reading of loose refs, only for them to be freed\nimmediately.\n\nSigned-off-by: Michael Haggerty <mhagger@alum.mit.edu>\n---\nFix a silly inefficiency from the lazy-loose changes.\n\n refs.c |    9 +++++++--\n 1 file changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex d6bdb47..26c8fcd 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -259,8 +259,13 @@ static void clear_ref_dir(struct ref_dir *dir);\n \n static void free_ref_entry(struct ref_entry *entry)\n {\n-\tif (entry->flag & REF_DIR)\n-\t\tclear_ref_dir(get_ref_dir(entry));\n+\tif (entry->flag & REF_DIR) {\n+\t\t/*\n+\t\t * Do not use get_ref_dir() here, as that might\n+\t\t * trigger the reading of loose refs.\n+\t\t */\n+\t\tclear_ref_dir(&entry->u.subdir);\n+\t}\n \tfree(entry);\n }\n \n-- \n1.7.10\n"}]}