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

[PATCH 1/4] Do not try to process objects more than once during fetch

From
Sergey Vlasov <vsu@altlinux.ru>
Date
Sep 14, 2005, 12:42 UTC
Message-ID
<20050914124255.GD24405@master.mivlgu.local>
In-Reply-To
<20050914124206.GC24405@master.mivlgu.local>

fetch.c:process() is often called more than once for the same object; e.g., for unpacked git repository with 7313 objects there are 320997 calls to process() for objects which were already seen (and 7528 of those calls are for tree objects, which is a real problem because of recursive processing).

---
 fetch.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
f8285569e916a21c28379b55415165a89794272a
diff --git a/fetch.c b/fetch.c
--- a/fetch.c
+++ b/fetch.c
@@ -7,6 +7,8 @@
 #include "blob.h"
 #include "refs.h"
 
+#define SEEN		(1u << 0)
+
 const char *write_ref = NULL;
 
 const unsigned char *current_ref = NULL;
@@ -126,6 +128,12 @@ static int process_object(struct object 
 static int process(unsigned char *sha1, const char *type)
 {
 	struct object *obj = lookup_object_type(sha1, type);
+
+	/* Do not try to process objects more than once */
+	if (obj->flags & SEEN)
+		return 0;
+	obj->flags |= SEEN;
+
 	if (has_sha1_file(sha1)) {
 		parse_object(sha1);
 		/* We already have it, so we should scan it now. */
Previous: Sergey VlasovNext: Sergey Vlasov
Message 2 of 15 in “Recovery after interrupted HTTP(s) fetch”
  1. 0/4 Recovery after interrupted HTTP(s) fetchSergey Vlasov, Sep 14, 2005
  2. 1/4 Do not try to process objects more than once during fetchSergey Vlasov, Sep 14, 2005
  3. 2/4 git-*-fetch: Gracefully recover from retrieval failureSergey Vlasov, Sep 14, 2005
  4. 3/4 git-fetch: Add --recover optionSergey Vlasov, Sep 14, 2005
  5. 4/4 Document git-fetch optionsSergey Vlasov, Sep 14, 2005
  6. Junio C HamanoSep 14, 2005
  7. Linus TorvaldsSep 14, 2005
  8. Junio C HamanoSep 14, 2005
  9. Daniel BarkalowSep 14, 2005
  10. Linus TorvaldsSep 14, 2005
  11. Daniel BarkalowSep 14, 2005
  12. Junio C HamanoSep 14, 2005
  13. Matthias UrlichsSep 15, 2005
  14. Daniel BarkalowSep 15, 2005
  15. Junio C HamanoSep 15, 2005

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.