git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/6] Omit extra_refs except when iterating using for_each_ref()

From
mhagger@alum.mit.edu <mhagger@alum.mit.edu>
Date
Dec 13, 2011, 20:06 UTC
Message-ID
<1323806811-5798-6-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1323806811-5798-1-git-send-email-mhagger@alum.mit.edu>
From: Michael Haggerty <mhagger@alum.mit.edu>

According to Junio, the only reference iteration function that needs to include the extra refs is for_each_ref(). So call do_for_each_extra_ref() directly from there instead of from do_for_each_ref().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 refs.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 843c530..f52d8b5 100644
--- a/refs.c
+++ b/refs.c
@@ -730,10 +730,6 @@ static int do_for_each_ref(const char *submodule, const char *base, each_ref_fn
 	struct ref_array *packed = get_packed_refs(submodule);
 	struct ref_array *loose = get_loose_refs(submodule);
 
-	retval = do_for_each_extra_ref(base, fn, trim, cb_data);
-	if (retval)
-		goto end_each;
-
 	while (p < packed->nr && l < loose->nr) {
 		struct ref_entry *entry;
 		int cmp = strcmp(packed->refs[p]->name, loose->refs[l]->name);
@@ -798,6 +794,9 @@ int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)
 
 int for_each_ref(each_ref_fn fn, void *cb_data)
 {
+	int retval = do_for_each_extra_ref("", fn, 0, cb_data);
+	if (retval)
+		return retval;
 	return do_for_each_ref(NULL, "", fn, 0, 0, cb_data);
 }
 
-- 
1.7.8
Previous: mhagger@alum.mit.eduNext: mhagger@alum.mit.edu
Message 6 of 7 in “Handle extra_refs separately from ref_caches”
  1. 0/6 Handle extra_refs separately from ref_cachesmhagger@alum.mit.edu, Dec 13, 2011
  2. 1/6 t5519: push two branches to alternate repomhagger@alum.mit.edu, Dec 13, 2011
  3. 2/6 add_extra_ref(): remove flag argumentmhagger@alum.mit.edu, Dec 13, 2011
  4. 3/6 Extract a function do_for_each_extra_ref()mhagger@alum.mit.edu, Dec 13, 2011
  5. 4/6 Store extra_refs in a separate data structuremhagger@alum.mit.edu, Dec 13, 2011
  6. 5/6 Omit extra_refs except when iterating using for_each_ref()mhagger@alum.mit.edu, Dec 13, 2011
  7. 6/6 do_for_each_extra_ref(): simplify signaturemhagger@alum.mit.edu, Dec 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.