diff options
| author | Taylor Blau <me@ttaylorr.com> | 2022-11-14 19:53:33 -0500 |
|---|---|---|
| committer | Taylor Blau <me@ttaylorr.com> | 2022-11-14 19:53:34 -0500 |
| commit | d0c3853034e7a0d7216d607da7980b0078101be5 (patch) | |
| tree | cf103cfec78d3a1c657aa9c3e24cb523a436a04d | |
| parent | Merge branch 'do/modernize-t7001' (diff) | |
| parent | index: raise a bug if the index is materialised more than once (diff) | |
| download | git-d0c3853034e7a0d7216d607da7980b0078101be5.tar.gz git-d0c3853034e7a0d7216d607da7980b0078101be5.zip | |
Merge branch 'al/trace2-clearing-skip-worktree'
Add trace2 counters to the region to clear skip worktree bits in a
sparse checkout.
* al/trace2-clearing-skip-worktree:
index: raise a bug if the index is materialised more than once
index: add trace2 region for clear skip worktree
| -rw-r--r-- | sparse-index.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/sparse-index.c b/sparse-index.c index e4a54ce194..8c269dab80 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -493,24 +493,42 @@ void clear_skip_worktree_from_present_files(struct index_state *istate) int dir_found = 1; int i; + int path_count[2] = {0, 0}; + int restarted = 0; if (!core_apply_sparse_checkout || sparse_expect_files_outside_of_patterns) return; + trace2_region_enter("index", "clear_skip_worktree_from_present_files", + istate->repo); restart: for (i = 0; i < istate->cache_nr; i++) { struct cache_entry *ce = istate->cache[i]; - if (ce_skip_worktree(ce) && - path_found(ce->name, &last_dirname, &dir_len, &dir_found)) { - if (S_ISSPARSEDIR(ce->ce_mode)) { - ensure_full_index(istate); - goto restart; + if (ce_skip_worktree(ce)) { + path_count[restarted]++; + if (path_found(ce->name, &last_dirname, &dir_len, &dir_found)) { + if (S_ISSPARSEDIR(ce->ce_mode)) { + if (restarted) + BUG("ensure-full-index did not fully flatten?"); + ensure_full_index(istate); + restarted = 1; + goto restart; + } + ce->ce_flags &= ~CE_SKIP_WORKTREE; } - ce->ce_flags &= ~CE_SKIP_WORKTREE; } } + + if (path_count[0]) + trace2_data_intmax("index", istate->repo, + "sparse_path_count", path_count[0]); + if (restarted) + trace2_data_intmax("index", istate->repo, + "sparse_path_count_full", path_count[1]); + trace2_region_leave("index", "clear_skip_worktree_from_present_files", + istate->repo); } /* |
