summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-06-29 21:04:01 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-29 22:24:29 (GMT)
commit51d1e83f91a16363930023a5c39f79f270c04653 (patch)
treeb828fd13144d10026feeafe14840411386eaa26e
parent75dedd5a21246be03ae443e9fc6a9f75c6d2995b (diff)
downloadgit-51d1e83f91a16363930023a5c39f79f270c04653.zip
git-51d1e83f91a16363930023a5c39f79f270c04653.tar.gz
git-51d1e83f91a16363930023a5c39f79f270c04653.tar.bz2
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 <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--pack-objects.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pack-objects.c b/pack-objects.c
index bed2497..6e17676 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -988,6 +988,13 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
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 --
* otherwise they would become too deep.