From: Jeff King <peff@peff.net>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] sha1_file: avoid re-preparing duplicate packs
Date: Fri, 2 Jun 2006 12:49:32 -0400 [thread overview]
Message-ID: <20060602164932.GA10216@coredump.intra.peff.net> (raw)
In-Reply-To: <7vk67zbksv.fsf@assigned-by-dhcp.cox.net>
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.
---
On Fri, Jun 02, 2006 at 09:10:24AM -0700, Junio C Hamano wrote:
> I agree 100% on "shouldn't" part. What I wonder is if everybody
> works correctly if we mmap the same file (all available .idx are
This patch avoids duplicates in the packed_git list. It's not necessary
under Linux, at least, but it just seems cleaner, and it's simple to do.
The list might still have packs that are now gone. I didn't want to
purge anything from the packed_git list since I'm not clear on whether
other code might have pointers into the mmap'd portion.
sha1_file.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 696e53f..aea0f40 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -617,6 +617,12 @@ static void prepare_packed_git_one(char
/* 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;
--
1.3.3.gfb825
next prev parent reply other threads:[~2006-06-02 16:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-02 15:32 [PATCH] handle concurrent pruning of packed objects Jeff King
2006-06-02 15:53 ` Junio C Hamano
2006-06-02 16:03 ` Junio C Hamano
2006-06-02 16:04 ` Jeff King
2006-06-02 16:10 ` Junio C Hamano
2006-06-02 16:49 ` Jeff King [this message]
2006-06-02 17:47 ` [PATCH] sha1_file: avoid re-preparing duplicate packs Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060602164932.GA10216@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox