From 51d1e83f91a16363930023a5c39f79f270c04653 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 29 Jun 2006 14:04:01 -0700 Subject: Do not try futile object pairs when repacking. In the repacking window, if both objects we are looking at already came from the same (old) pack-file, don't bother delta'ing them against each other. That means that we'll still always check for better deltas for (and against!) _unpacked_ objects, but assuming incremental repacks, you'll avoid the delta creation 99% of the time. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- pack-objects.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pack-objects.c') diff --git a/pack-objects.c b/pack-objects.c index bed2497b79..6e1767652c 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -987,6 +987,13 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, if (trg_entry->preferred_base) return -1; + /* + * We do not bother to try a delta that we discarded + * on an earlier try. + */ + if (trg_entry->in_pack && trg_entry->in_pack == src_entry->in_pack) + return 0; + /* * If the current object is at pack edge, take the depth the * objects that depend on the current object into account -- -- cgit v1.2.3