[PATCH 06/10] dir: use expand_to_path() for sparse directories
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Apr 13, 2021, 14:01 UTC
- Message-ID
- <434306541613cbd0b9bb4ebb3102d97e3df9eb94.1618322497.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.932.git.1618322497.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
The recently-implemented expand_to_path() method can supply position queries a faster response if they are specifically asking for a path within the sparse cone. Since this is the most-common scenario, this provides a significant speedup.
Update t1092-sparse-checkout-compatibility.sh to fully ensure that 'git status' does not expand a sparse index to a full one, even when there exist untracked files.
The performance test script p2000-sparse-operations.sh demonstrates that this is the final hole to fill to allow 'git status' to speed up when using a sparse index:
Test HEAD~1 HEAD ------------------------------------------------------------------------------ 2000.4: git status (sparse-index-v3) 1.50(1.43+0.10) 0.04(0.04+0.03) -97.3% 2000.5: git status (sparse-index-v4) 1.50(1.43+0.10) 0.04(0.03+0.04) -97.3%
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> --- t/t1092-sparse-checkout-compatibility.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index 380a085f8ec4..b937d7096afd 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -456,8 +456,9 @@ test_expect_success 'sparse-index is not expanded' ' init_repos && rm -f trace2.txt && + echo >>sparse-index/untracked.txt && GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \ - git -C sparse-index status -uno && + git -C sparse-index status && test_region ! index ensure_full_index trace2.txt '
-- gitgitgadget