diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
index be5e86c80628491d012a605276280e7784d6453c_aGdleHQvaW5vdGlmeS9zZXJ2ZXIucHk=..db9d162337871e3110f3c45dd994db3d28614ba0_aGdleHQvaW5vdGlmeS9zZXJ2ZXIucHk= 100644
--- a/hgext/inotify/server.py
+++ b/hgext/inotify/server.py
@@ -213,7 +213,9 @@
             if time != int(st_mtime):
                 return 'l'
             return 'n'
-        if type_ == '?' and self.dirstate._ignore(fn):
+        if type_ == '?' and self.dirstate._dirignore(fn):
+            # we must check not only if the file is ignored, but if any part
+            # of its path match an ignore pattern
             return 'i'
         return type_
 
diff --git a/tests/test-inotify b/tests/test-inotify
index be5e86c80628491d012a605276280e7784d6453c_dGVzdHMvdGVzdC1pbm90aWZ5..db9d162337871e3110f3c45dd994db3d28614ba0_dGVzdHMvdGVzdC1pbm90aWZ5 100755
--- a/tests/test-inotify
+++ b/tests/test-inotify
@@ -97,4 +97,17 @@
 echo b >> 1844/foo
 hg ci 1844 -m 'broken'
 
+# Test for issue884: "Build products not ignored until .hgignore is touched"
+echo '^build$' > .hgignore
+hg add .hgignore
+hg ci .hgignore -m 'ignorelist'
+
+# Now, lets add some build products...
+mkdir build
+touch build/x
+touch build/y
+
+# build/x & build/y shouldn't appear in "hg st"
+hg st
+
 kill `cat hg.pid`