Code

sha1_file: avoid re-preparing duplicate packs
authorJeff King <peff@peff.net>
Fri, 2 Jun 2006 16:49:32 +0000 (12:49 -0400)
committerJunio C Hamano <junkio@cox.net>
Fri, 2 Jun 2006 18:09:44 +0000 (11:09 -0700)
When adding packs, skip the pack if we already have it in the packed_git
list. This might happen if we are re-preparing our packs because of a
missing object.

Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c

index 696e53f1c0c9042e925a4d64500ae43a0ffd6539..aea0f40d57a134a2a853136cd0815e5c743a115d 100644 (file)
@@ -617,6 +617,12 @@ static void prepare_packed_git_one(char *objdir, int local)
 
                /* we have .idx.  Is it a file we can map? */
                strcpy(path + len, de->d_name);
+               for (p = packed_git; p; p = p->next) {
+                       if (!memcmp(path, p->pack_name, len + namelen - 4))
+                               break;
+               }
+               if (p)
+                       continue;
                p = add_packed_git(path, len + namelen, local);
                if (!p)
                        continue;