Export matches_pack_name() and fix its return value
[gitweb.git] / read-cache.c
index 865369df0e7210446853c6704f68f12a8872124b..8b1c94e0e3f539cd0b507fd130b60aa443b9680b 100644 (file)
@@ -7,6 +7,7 @@
 #include "cache.h"
 #include "cache-tree.h"
 #include "refs.h"
+#include "dir.h"
 
 /* Index extensions.
  *
@@ -798,7 +799,7 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
        return updated;
 }
 
-int refresh_index(struct index_state *istate, unsigned int flags)
+int refresh_index(struct index_state *istate, unsigned int flags, const char **pathspec, char *seen)
 {
        int i;
        int has_errors = 0;
@@ -824,6 +825,9 @@ int refresh_index(struct index_state *istate, unsigned int flags)
                        continue;
                }
 
+               if (pathspec && !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen))
+                       continue;
+
                new = refresh_cache_ent(istate, ce, really, &cache_errno);
                if (new == ce)
                        continue;