@matheusbsbs / matheus-bagliano / commits / 86f7780c0b
Fork 0

sha1_file: avoid re-preparing duplicate packs

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>

Jeff King committed Jun 2, 2006 at 12:49 UTC 86f7780c0b77b3c162f85d499189f9d1f0b296df
1 file changed +6
sha1_file.c
+6
@@ -617,6 +617,12 @@ static void prepare_packed_git_one(char *objdir, int local)
617
618 /* we have .idx. Is it a file we can map? */
619 strcpy(path + len, de->d_name);
620 + for (p = packed_git; p; p = p->next) {
621 + if (!memcmp(path, p->pack_name, len + namelen - 4))
622 + break;
623 + }
624 + if (p)
625 + continue;
626 p = add_packed_git(path, len + namelen, local);
627 if (!p)
628 continue;