diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
index f680ed10e2c4a2f92b30723f7d74c9b3b51db60b_bWVyY3VyaWFsL2NtZHV0aWwucHk=..f11eee00c6523347b4c3eff694ddf542a19864f6_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1224,8 +1224,8 @@
             ui.status(_("skipping missing subrepository: %s\n")
                            % join(subpath))
 
-    for f in match.files():
-        if match.exact(f) or not explicitonly:
+    if not explicitonly:
+        for f in match.files():
             if f not in repo.dirstate and not os.path.isdir(match.rel(join(f))):
                 if f not in forgot:
                     if os.path.exists(match.rel(join(f))):
diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t
index f680ed10e2c4a2f92b30723f7d74c9b3b51db60b_dGVzdHMvdGVzdC1zdWJyZXBvLXJlY3Vyc2lvbi50..f11eee00c6523347b4c3eff694ddf542a19864f6_dGVzdHMvdGVzdC1zdWJyZXBvLXJlY3Vyc2lvbi50 100644
--- a/tests/test-subrepo-recursion.t
+++ b/tests/test-subrepo-recursion.t
@@ -195,7 +195,6 @@
   $ hg add foo/bar/z2.txt
   $ hg status -S
   A foo/bar/z2.txt
-This is expected to forget the file, but is currently broken
   $ hg forget foo/bar/z2.txt
   $ hg status -S
   ? foo/bar/z2.txt
@@ -199,6 +198,11 @@
   $ hg forget foo/bar/z2.txt
   $ hg status -S
   ? foo/bar/z2.txt
+  $ hg forget foo/bar/z2.txt
+  not removing foo/bar/z2.txt: file is already untracked
+  [1]
+  $ hg status -S
+  ? foo/bar/z2.txt
   $ rm foo/bar/z2.txt
 
 Log with the relationships between repo and its subrepo: