]> git.ipfire.org Git - thirdparty/git.git/commit - fast-import.c
Don't allow fast-import tree delta chains to exceed maximum depth
authorShawn O. Pearce <spearce@spearce.org>
Wed, 14 Nov 2007 04:48:42 +0000 (23:48 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Nov 2007 05:57:53 +0000 (21:57 -0800)
commit436e7a74c638bc9de2e585ce3eb0fd4bd6e06115
treecc5c70ae6761b14766e9c444ba43c517fea4ffdc
parent245de36f035f9d549df2b1509787c25648fd611f
Don't allow fast-import tree delta chains to exceed maximum depth

Brian Downing noticed fast-import can produce tree depths of up
to 6,035 objects and even deeper.  Long delta chains can create
very small packfiles but cause problems during repacking as git
needs to unpack each tree to count the reachable blobs.

What's happening here is the active branch cache isn't big enough.
We're swapping out the branch and thus recycling the tree information
(struct tree_content) back into the free pool.  When we later reload
the tree we set the delta_depth to 0 but we kept the tree we just
reloaded as a delta base.

So if the tree we reloaded was already at the maximum depth we
wouldn't know it and make the new tree a delta.  Multiply the
number of times the branch cache has to swap out the tree times
max_depth (10) and you get the maximum delta depth of a tree created
by fast-import.  In Brian's case above the active branch cache had
to swap the branch out 603/604 times during this import to produce
a tree with a delta depth of 6035.

Acked-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c