How do packfile delta chains work and what controls them?
AdvancedConceptGit internals: objects, refs and the index
Answer
Inside a pack, an object is either stored whole or as a delta against another object (OFS_DELTA by offset or REF_DELTA by ID). Git sorts candidates by type, name and size to find good bases, and chains can be up to pack.depth deep (default 50) within a pack.window of candidates (default 10). Deeper or wider settings shrink the pack at the cost of CPU on repack and slower reads.
git repack -adf --depth=250 --window=250
git verify-pack -v .git/objects/pack/*.idx | head
More on Git internals: objects, refs and the index
What are the four object types in Git's object database?BeginnerIs Git a snapshot system or a diff system?BeginnerWhat is the SHA-1 (or SHA-256) hash of an object and how is it computed?BeginnerWhere does Git store objects on disk, and what are loose objects versus packfiles?IntermediateWhat exactly is a branch, and what does creating one cost?IntermediateWhat is HEAD?Beginner