summaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-07-29 14:52:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-29 19:36:34 (GMT)
commit4eaffd81a5fbffc692f1044374a3a16689fc37a5 (patch)
tree9e87910aa10dbb5bed9e86c67cd6b93593e275af /pathspec.c
parent5e7cbab19680745d4f3e0c50903025d9f02e7468 (diff)
downloadgit-4eaffd81a5fbffc692f1044374a3a16689fc37a5.zip
git-4eaffd81a5fbffc692f1044374a3a16689fc37a5.tar.gz
git-4eaffd81a5fbffc692f1044374a3a16689fc37a5.tar.bz2
pathspec: stop calling ensure_full_index
The add_pathspec_matches_against_index() focuses on matching a pathspec to file entries in the index. This already works correctly for its only use: checking if untracked files exist in the index. The compatibility checks in t1092 already test that 'git add <dir>' works for a directory outside of the sparse cone. That provides coverage for removing this guard. This finalizes our ability to run 'git add .' without expanding a sparse index to a full one. This is evidenced by an update to t1092 and by these performance numbers for p2000-sparse-operations.sh: Test HEAD~1 HEAD -------------------------------------------------------------------------------- 2000.10: git add . (full-index-v3) 0.37(0.28+0.07) 0.36(0.27+0.06) -2.7% 2000.11: git add . (full-index-v4) 0.33(0.26+0.06) 0.32(0.28+0.05) -3.0% 2000.12: git add . (sparse-index-v3) 0.57(0.53+0.07) 0.06(0.06+0.07) -89.5% 2000.13: git add . (sparse-index-v4) 0.57(0.53+0.07) 0.05(0.03+0.09) -91.2% While the ~90% improvement is shown by the test results, it is worth noting that expanding the sparse index was adding overhead in previous commits. Comparing to the full index case, we see the performance go from 0.33s to 0.05s, an 85% improvement. Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/pathspec.c b/pathspec.c
index 08f8d3e..44306fd 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -37,8 +37,6 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec,
num_unmatched++;
if (!num_unmatched)
return;
- /* TODO: audit for interaction with sparse-index. */
- ensure_full_index(istate);
for (i = 0; i < istate->cache_nr; i++) {
const struct cache_entry *ce = istate->cache[i];
if (sw_action == PS_IGNORE_SKIP_WORKTREE && ce_skip_worktree(ce))