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

Re: http-fetch troubles

From
Junio C Hamano <junkio@cox.net>
Date
Jun 2, 2006, 22:15 UTC
Message-ID
<7vmzcv9pba.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vac8vbgqg.fsf_-_@assigned-by-dhcp.cox.net>

I think this fixes the http trouble with tree parser change in the "next" branch.

-- >8 -- fetch.c: do not call process_tree() from process_tree().

This function reads a freshly fetched tree object, and schedules the objects pointed by it for further fetching, so calling lookup-tree and doing process_tree() recursively from there does not make much sense. We need to use process() on it to make sure we fetch it first.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/fetch.c b/fetch.c
index ec2d8c3..107504b 100644
--- a/fetch.c
+++ b/fetch.c
@@ -46,13 +46,20 @@ static int process_tree(struct tree *tre
 	desc.buf = tree->buffer;
 	desc.size = tree->size;
 	while (tree_entry(&desc, &entry)) {
+		struct object *obj = NULL;
+
 		if (S_ISDIR(entry.mode)) {
 			struct tree *tree = lookup_tree(entry.sha1);
-			process_tree(tree);
-		} else {
+			if (tree)
+				obj = &tree->object;
+		}
+		else {
 			struct blob *blob = lookup_blob(entry.sha1);
-			process(&blob->object);
+			if (blob)
+				obj = &blob->object;
 		}
+		if (!obj || process(obj))
+			return -1;
 	}
 	free(tree->buffer);
 	tree->buffer = NULL;
Previous: Junio C HamanoNext: Linus Torvalds
Message 4 of 9 in “HTTP questions”
  1. Nick HengeveldJun 1, 2006
  2. Junio C HamanoJun 2, 2006
  3. http-fetch troublesJunio C Hamano, Jun 2, 2006
  4. Junio C HamanoJun 2, 2006
  5. Linus TorvaldsJun 2, 2006
  6. Becky BruceJun 3, 2006
  7. Junio C HamanoJun 3, 2006
  8. Linus TorvaldsJun 3, 2006
  9. Junio C HamanoJun 3, 2006

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.