• D
    fast-import: prevent producing bad delta · 8fb3ad76
    Dmitry Ivankov 提交于
    To produce deltas for tree objects fast-import tracks two versions
    of tree's entries - base and current one. Base version stands both
    for a delta base of this tree, and for a entry inside a delta base
    of a parent tree. So care should be taken to keep it in sync.
    
    tree_content_set cuts away a whole subtree and replaces it with a
    new one (or NULL for lazy load of a tree with known sha1). It
    keeps a base sha1 for this subtree (needed for parent tree). And
    here is the problem, 'subtree' tree root doesn't have the implied
    base version entries.
    
    Adjusting the subtree to include them would mean a deep rewrite of
    subtree. Invalidating the subtree base version would mean recursive
    invalidation of parents' base versions. So just mark this tree as
    do-not-delta me. Abuse setuid bit for this purpose.
    
    tree_content_replace is the same as tree_content_set except that is
    is used to replace the root, so just clearing base sha1 here (instead
    of setting the bit) is fine.
    
    [di: log message]
    Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: NDmitry Ivankov <divanorama@gmail.com>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    8fb3ad76
t9300-fast-import.sh 50.8 KB