diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
index f7e0d95d0a0bc5545f3dad40b9ceaee362d7c553_aGdleHQvbGFyZ2VmaWxlcy9yZXBvc2V0dXAucHk=..41417443b7d05c5b49aedd60d811aa020709ea56_aGdleHQvbGFyZ2VmaWxlcy9yZXBvc2V0dXAucHk= 100644
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -118,8 +118,10 @@
                 # handle it -- thus gaining a big performance boost.
                 lfdirstate = lfutil.openlfdirstate(ui, self)
                 if match.files() and not match.anypats():
-                    matchedfiles = [f for f in match.files() if f in lfdirstate]
-                    if not matchedfiles:
+                    for f in lfdirstate:
+                        if match(f):
+                            break
+                    else:
                         return super(lfiles_repo, self).status(node1, node2,
                                 match, listignored, listclean,
                                 listunknown, listsubrepos)
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
index f7e0d95d0a0bc5545f3dad40b9ceaee362d7c553_dGVzdHMvdGVzdC1sYXJnZWZpbGVzLnQ=..41417443b7d05c5b49aedd60d811aa020709ea56_dGVzdHMvdGVzdC1sYXJnZWZpbGVzLnQ= 100644
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -948,4 +948,7 @@
   $ test -L largelink
   $ cd ..
 
+test for pattern matching on 'hg status':
+to boost performance, largefiles checks whether specified patterns are
+related to largefiles in working directory (NOT to STANDIN) or not.
 
@@ -951,1 +954,44 @@
 
+  $ hg init statusmatch
+  $ cd statusmatch
+
+  $ mkdir -p a/b/c/d
+  $ echo normal > a/b/c/d/e.normal.txt
+  $ hg add a/b/c/d/e.normal.txt
+  $ echo large > a/b/c/d/e.large.txt
+  $ hg add --large a/b/c/d/e.large.txt
+  $ mkdir -p a/b/c/x
+  $ echo normal > a/b/c/x/y.normal.txt
+  $ hg add a/b/c/x/y.normal.txt
+  $ hg commit -m 'add files'
+  Invoking status precommit hook
+  A a/b/c/d/e.large.txt
+  A a/b/c/d/e.normal.txt
+  A a/b/c/x/y.normal.txt
+
+(1) no pattern: no performance boost
+  $ hg status -A
+  C a/b/c/d/e.large.txt
+  C a/b/c/d/e.normal.txt
+  C a/b/c/x/y.normal.txt
+
+(2) pattern not related to largefiles: performance boost
+  $ hg status -A a/b/c/x
+  C a/b/c/x/y.normal.txt
+
+(3) pattern related to largefiles: no performance boost
+  $ hg status -A a/b/c/d
+  C a/b/c/d/e.large.txt
+  C a/b/c/d/e.normal.txt
+
+(4) pattern related to STANDIN (not to largefiles): performance boost
+  $ hg status -A .hglf/a
+  C .hglf/a/b/c/d/e.large.txt
+
+(5) mixed case: no performance boost
+  $ hg status -A a/b/c/x a/b/c/d
+  C a/b/c/d/e.large.txt
+  C a/b/c/d/e.normal.txt
+  C a/b/c/x/y.normal.txt
+
+  $ cd ..