Commits

Carl Meyer committed 37d8338

fix broken diff_states prefix matching

Comments (0)

Files changed (1)

tests/test_pip.py

 
     """
     ignore = ignore or []
-    # FIXME: this code ignores too much, e.g. foo/bar when only foo/b is specified
+    def prefix_match(path, prefix):
+        if path == prefix: 
+            return True
+        return path.startswith(prefix) and path[len(prefix)] == os.path.sep
+        
     start_keys = set([k for k in start.keys()
-                      if not any([k.startswith(i) for i in ignore])])
+                      if not any([prefix_match(k, i) for i in ignore])])
     end_keys = set([k for k in end.keys()
-                    if not any([k.startswith(i) for i in ignore])])
+                    if not any([prefix_match(k, i) for i in ignore])])
     deleted = dict([(k, start[k]) for k in start_keys.difference(end_keys)])
     created = dict([(k, end[k]) for k in end_keys.difference(start_keys)])
     updated = {}