From: Jonathan Tan Date: Tue, 9 Oct 2018 18:40:37 +0000 (-0700) Subject: cache-tree: skip some blob checks in partial clone X-Git-Tag: v2.20.0-rc0~148^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2f215ff10bdf02f6c760ea34968fc39ae75ae449?hp=2f215ff10bdf02f6c760ea34968fc39ae75ae449 cache-tree: skip some blob checks in partial clone In a partial clone, whenever a sparse checkout occurs, the existence of all blobs in the index is verified, whether they are included or excluded by the .git/info/sparse-checkout specification. This significantly degrades performance because a lazy fetch occurs whenever the existence of a missing blob is checked. This is because cache_tree_update() checks the existence of all objects in the index, whether or not CE_SKIP_WORKTREE is set on them. Teach cache_tree_update() to skip checking CE_SKIP_WORKTREE objects when the repository is a partial clone. This improves performance for sparse checkout and also other operations that use cache_tree_update(). Instead of completely removing the check, an argument could be made that the check should instead be replaced by a check that the blob is promised, but for performance reasons, I decided not to do this. If the user needs to verify the repository, it can be done using fsck (which will notify if a tree points to a missing and non-promised blob, whether the blob is included or excluded by the sparse-checkout specification). Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano ---