diff -r 216f273b6b30 -r 0540c1628fd4 mercurial/localrepo.py --- a/mercurial/localrepo.py Wed Jun 08 09:31:01 2022 +0200 +++ b/mercurial/localrepo.py Sat Jun 11 00:56:50 2022 +0200 @@ -1747,7 +1747,9 @@ def _makedirstate(self): """Extension point for wrapping the dirstate per-repo.""" - sparsematchfn = lambda: sparse.matcher(self) + sparsematchfn = None + if sparse.use_sparse(self): + sparsematchfn = lambda: sparse.matcher(self) v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT th = requirementsmod.DIRSTATE_TRACKED_HINT_V1 use_dirstate_v2 = v2_req in self.requirements