mercurial/narrowspec.py
changeset 47303 e4ccc341e65b
parent 46606 ced66295ea90
child 47739 6a06155dfaef
--- a/mercurial/narrowspec.py	Tue May 18 13:34:06 2021 -0400
+++ b/mercurial/narrowspec.py	Tue May 18 13:08:42 2021 -0400
@@ -346,6 +346,9 @@
         ds.drop(f)
 
     pctx = repo[b'.']
+
+    # only update added files that are in the sparse checkout
+    addedmatch = matchmod.intersectmatchers(addedmatch, sparse.matcher(repo))
     newfiles = [f for f in pctx.manifest().walk(addedmatch) if f not in ds]
     for f in newfiles:
         ds.normallookup(f)