Skip to content

index: add trace2 region for clear skip worktree

Anh Le via GitGitGadget git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesIn review
  2. v31 patch 1 replySuperseded
  3. v21 patch 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch5 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2index: add trace2 region for clear skip worktreesparse-index.c+22 -60 replies
2/2index: raise a bug if the index is materialised more than oncesparse-index.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] index: add trace2 region for clear skip worktree

In large repository using sparse checkout, checking whether a file marked with skip worktree is present on disk and its skip worktree bit should be cleared can take a considerable amount of time. Add a trace2 region to surface this information.

Anh Le (2):
index: add trace2 region for clear skip worktree
index: raise a bug if the index is materialised more than once

 sparse-index.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

base-commit: 1fc3c0ad407008c2f71dd9ae1241d8b75f8ef886
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1368%2FHaizzz%2Fmaster-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1368/Haizzz/master-v4
Pull-Request: https://github.com/git/git/pull/1368

Range-diff vs v3:

1: d0d9f258b08 ! 1: 33e9b2afd91 index: add trace2 region for clear skip worktree

     @@ Metadata
       ## Commit message ##
          index: add trace2 region for clear skip worktree
      
     -    In a large repository using sparse checkout, checking whether a file marked
     -    with skip worktree is present on disk and its skip worktree bit should be
     -    cleared can take a considerable amount of time. Add a trace2 region to
     -    surface this information, keeping a count of how many paths have been
     -    checked and separately keep counts for after a full index is materialised.
     +    When using sparse checkout, clear_skip_worktree_from_present_files() must
     +    enumerate index entries to find ones with the SKIP_WORKTREE bit to
     +    determine whether those index entries exist on disk (in which case their
     +    SKIP_WORKTREE bit should be removed).
     +
     +    In a large repository, this may take considerable time depending on the
     +    size of the index.
     +
     +    Add a trace2 region to surface this information, keeping a count of how
     +    many paths have been checked. Separately, keep counts after a full index is
     +    materialized.
      
          Signed-off-by: Anh Le <[email protected]>
      
     @@ sparse-index.c: void clear_skip_worktree_from_present_files(struct index_state *
       		return;
       
      +	trace2_region_enter("index", "clear_skip_worktree_from_present_files",
     -+											istate->repo);
     ++			    istate->repo);
       restart:
       	for (i = 0; i < istate->cache_nr; i++) {
       		struct cache_entry *ce = istate->cache[i];
     @@ sparse-index.c: void clear_skip_worktree_from_present_files(struct index_state *
      +			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;
     @@ sparse-index.c: void clear_skip_worktree_from_present_files(struct index_state *
      +
      +	if (path_count[0])
      +		trace2_data_intmax("index", istate->repo,
     -+											 "sparse_path_count", path_count[0]);
     ++				   "sparse_path_count", path_count[0]);
      +	if (restarted)
      +		trace2_data_intmax("index", istate->repo,
     -+											 "sparse_path_count_full", path_count[1]);
     ++				   "sparse_path_count_full", path_count[1]);
      +	trace2_region_leave("index", "clear_skip_worktree_from_present_files",
     -+										  istate->repo);
     ++			    istate->repo);
       }
       
       /*

-: ----------- > 2: 91ad7973307 index: raise a bug if the index is materialised more than once

Signature · 1 line
gitgitgadget