]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'nd/submodule-pathspec-ending-with-slash'
authorJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2014 22:01:15 +0000 (14:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2014 22:01:15 +0000 (14:01 -0800)
Allow "git cmd path/", when the 'path' is where a submodule is
bound to the top-level working tree, to match 'path', despite the
extra and unnecessary trailing slash.

* nd/submodule-pathspec-ending-with-slash:
  clean: use cache_name_is_other()
  clean: replace match_pathspec() with dir_path_match()
  pathspec: pass directory indicator to match_pathspec_item()
  match_pathspec: match pathspec "foo/" against directory "foo"
  dir.c: prepare match_pathspec_item for taking more flags
  pathspec: rename match_pathspec_depth() to match_pathspec()
  pathspec: convert some match_pathspec_depth() to dir_path_match()
  pathspec: convert some match_pathspec_depth() to ce_path_match()

22 files changed:
builtin/add.c
builtin/checkout.c
builtin/clean.c
builtin/commit.c
builtin/grep.c
builtin/ls-files.c
builtin/ls-tree.c
builtin/rm.c
builtin/update-index.c
cache.h
diff-lib.c
dir.c
dir.h
pathspec.c
preload-index.c
read-cache.c
rerere.c
resolve-undo.c
revision.c
t/t4010-diff-pathspec.sh
t/t6131-pathspec-icase.sh
wt-status.c

index 2a2722fa10aa981695b21984e7c425c35b4f18d0..672adc01ffc07fa97c305f9110cfa3995658b922 100644 (file)
@@ -208,8 +208,7 @@ static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec,
        i = dir->nr;
        while (--i >= 0) {
                struct dir_entry *entry = *src++;
-               if (match_pathspec_depth(pathspec, entry->name, entry->len,
-                                        prefix, seen))
+               if (dir_path_match(entry, pathspec, prefix, seen))
                        *dst++ = entry;
                else if (flag & WARN_IMPLICIT_DOT)
                        /*
index 5df3837e3102e2f7d432ec11bb4685535bfaa0ac..ada51fa70ff59b10fd79168a4377d923638591e9 100644 (file)
@@ -297,8 +297,7 @@ static int checkout_paths(const struct checkout_opts *opts,
                 * match_pathspec() for _all_ entries when
                 * opts->source_tree != NULL.
                 */
-               if (match_pathspec_depth(&opts->pathspec, ce->name, ce_namelen(ce),
-                                  0, ps_matched))
+               if (ce_path_match(ce, &opts->pathspec, ps_matched))
                        ce->ce_flags |= CE_MATCHED;
        }
 
index 2f26297142fde89ec842d4e01665b3ebb24a9b59..cb02a5330ac58266ec4bd0414414bc6f08b92ed8 100644 (file)
@@ -933,36 +933,18 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 
        for (i = 0; i < dir.nr; i++) {
                struct dir_entry *ent = dir.entries[i];
-               int len, pos;
                int matches = 0;
-               const struct cache_entry *ce;
                struct stat st;
                const char *rel;
 
-               /*
-                * Remove the '/' at the end that directory
-                * walking adds for directory entries.
-                */
-               len = ent->len;
-               if (len && ent->name[len-1] == '/')
-                       len--;
-               pos = cache_name_pos(ent->name, len);
-               if (0 <= pos)
-                       continue;       /* exact match */
-               pos = -pos - 1;
-               if (pos < active_nr) {
-                       ce = active_cache[pos];
-                       if (ce_namelen(ce) == len &&
-                           !memcmp(ce->name, ent->name, len))
-                               continue; /* Yup, this one exists unmerged */
-               }
+               if (!cache_name_is_other(ent->name, ent->len))
+                       continue;
 
                if (lstat(ent->name, &st))
                        die_errno("Cannot lstat '%s'", ent->name);
 
                if (pathspec.nr)
-                       matches = match_pathspec_depth(&pathspec, ent->name,
-                                                      len, 0, NULL);
+                       matches = dir_path_match(ent, &pathspec, 0, NULL);
 
                if (S_ISDIR(st.st_mode)) {
                        if (remove_directories || (matches == MATCHED_EXACTLY)) {
index 9c51b129e856b9c00a93097dcebd5e8b9c5fe128..824be655857bf4fa5b1992054ef1f8948835df85 100644 (file)
@@ -234,7 +234,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
 
                if (ce->ce_flags & CE_UPDATE)
                        continue;
-               if (!match_pathspec_depth(pattern, ce->name, ce_namelen(ce), 0, m))
+               if (!ce_path_match(ce, pattern, m))
                        continue;
                item = string_list_insert(list, ce->name);
                if (ce_skip_worktree(ce))
index 63f86032d91f00fc607f7d3b26ec941bb7a4c76c..69ac2d8797ec32dc206425db0a2f3d7356810cfe 100644 (file)
@@ -379,7 +379,7 @@ static int grep_cache(struct grep_opt *opt, const struct pathspec *pathspec, int
                const struct cache_entry *ce = active_cache[nr];
                if (!S_ISREG(ce->ce_mode))
                        continue;
-               if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL))
+               if (!ce_path_match(ce, pathspec, NULL))
                        continue;
                /*
                 * If CE_VALID is on, we assume worktree file and its cache entry
@@ -524,9 +524,7 @@ static int grep_directory(struct grep_opt *opt, const struct pathspec *pathspec,
 
        fill_directory(&dir, pathspec);
        for (i = 0; i < dir.nr; i++) {
-               const char *name = dir.entries[i]->name;
-               int namelen = strlen(name);
-               if (!match_pathspec_depth(pathspec, name, namelen, 0, NULL))
+               if (!dir_path_match(dir.entries[i], pathspec, 0, NULL))
                        continue;
                hit |= grep_file(opt, dir.entries[i]->name);
                if (hit && opt->status_only)
index e1cf6d8547d4aa7f548fb80f0efb8f4e7b1d9c8e..47c38808a26a4602f8bd2c7d87f67770a625c679 100644 (file)
@@ -64,7 +64,7 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent)
        if (len >= ent->len)
                die("git ls-files: internal error - directory entry not superset of prefix");
 
-       if (!match_pathspec_depth(&pathspec, ent->name, ent->len, len, ps_matched))
+       if (!dir_path_match(ent, &pathspec, len, ps_matched))
                return;
 
        fputs(tag, stdout);
@@ -139,7 +139,9 @@ static void show_ce_entry(const char *tag, const struct cache_entry *ce)
        if (len >= ce_namelen(ce))
                die("git ls-files: internal error - cache entry not superset of prefix");
 
-       if (!match_pathspec_depth(&pathspec, ce->name, ce_namelen(ce), len, ps_matched))
+       if (!match_pathspec(&pathspec, ce->name, ce_namelen(ce),
+                           len, ps_matched,
+                           S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode)))
                return;
 
        if (tag && *tag && show_valid_bit &&
@@ -195,7 +197,8 @@ static void show_ru_info(void)
                len = strlen(path);
                if (len < max_prefix_len)
                        continue; /* outside of the prefix */
-               if (!match_pathspec_depth(&pathspec, path, len, max_prefix_len, ps_matched))
+               if (!match_pathspec(&pathspec, path, len,
+                                   max_prefix_len, ps_matched, 0))
                        continue; /* uninterested */
                for (i = 0; i < 3; i++) {
                        if (!ui->mode[i])
index 65ec93184614619cac925c17ef3ebc90cd30a82c..51184dfa2efa46323e79c4504121bf5fe948a6d2 100644 (file)
@@ -171,7 +171,7 @@ int cmd_ls_tree(int argc, const char **argv, const char *prefix)
         * show_recursive() rolls its own matching code and is
         * generally ignorant of 'struct pathspec'. The magic mask
         * cannot be lifted until it is converted to use
-        * match_pathspec_depth() or tree_entry_interesting()
+        * match_pathspec() or tree_entry_interesting()
         */
        parse_pathspec(&pathspec, PATHSPEC_GLOB | PATHSPEC_ICASE,
                       PATHSPEC_PREFER_CWD,
index 171f37c1cc5371c307ef16ce67fefc1c40fbc2c2..960634dd0c52f1da689e8a54980e5e81cf2d2f36 100644 (file)
@@ -308,7 +308,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 
        for (i = 0; i < active_nr; i++) {
                const struct cache_entry *ce = active_cache[i];
-               if (!match_pathspec_depth(&pathspec, ce->name, ce_namelen(ce), 0, seen))
+               if (!ce_path_match(ce, &pathspec, seen))
                        continue;
                ALLOC_GROW(list.entry, list.nr + 1, list.alloc);
                list.entry[list.nr].name = xstrdup(ce->name);
index 00313f373aadd989e0627b0b3068676c66c17a9b..d12ad95f3e210f780d95334d59a58e6b9d3b69ad 100644 (file)
@@ -12,6 +12,7 @@
 #include "resolve-undo.h"
 #include "parse-options.h"
 #include "pathspec.h"
+#include "dir.h"
 
 /*
  * Default to not allowing changes to the list of files. The
@@ -561,7 +562,7 @@ static int do_reupdate(int ac, const char **av,
                int save_nr;
                char *path;
 
-               if (ce_stage(ce) || !ce_path_match(ce, &pathspec))
+               if (ce_stage(ce) || !ce_path_match(ce, &pathspec, NULL))
                        continue;
                if (has_head)
                        old = read_one_ent(NULL, head_sha1,
diff --git a/cache.h b/cache.h
index 4007aa84508243e78c968871b55c31434f020c48..5994f7a2034268ce4f69afc5e99aafe7586ccef7 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -503,8 +503,6 @@ extern void *read_blob_data_from_index(struct index_state *, const char *, unsig
 extern int ie_match_stat(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 extern int ie_modified(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 
-extern int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec);
-
 #define HASH_WRITE_OBJECT 1
 #define HASH_FORMAT_CHECK 2
 extern int index_fd(unsigned char *sha1, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
index 346cac651da725af07a304194d8d8e04b2f080b7..2eddc66bbd5cf37e4649e219a28c951ed134557c 100644 (file)
@@ -11,6 +11,7 @@
 #include "unpack-trees.h"
 #include "refs.h"
 #include "submodule.h"
+#include "dir.h"
 
 /*
  * diff-files
@@ -108,7 +109,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                if (diff_can_quit_early(&revs->diffopt))
                        break;
 
-               if (!ce_path_match(ce, &revs->prune_data))
+               if (!ce_path_match(ce, &revs->prune_data, NULL))
                        continue;
 
                if (ce_stage(ce)) {
@@ -438,7 +439,7 @@ static int oneway_diff(const struct cache_entry * const *src,
        if (tree == o->df_conflict_entry)
                tree = NULL;
 
-       if (ce_path_match(idx ? idx : tree, &revs->prune_data)) {
+       if (ce_path_match(idx ? idx : tree, &revs->prune_data, NULL)) {
                do_oneway_diff(o, idx, tree);
                if (diff_can_quit_early(&revs->diffopt)) {
                        o->exiting_early = 1;
diff --git a/dir.c b/dir.c
index b35b6330f850f610b582b189d7e4d6a9ba4495db..98bb50fbabb69d25443df8ca4d29e11dea746a60 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -195,6 +195,9 @@ int within_depth(const char *name, int namelen,
        return 1;
 }
 
+#define DO_MATCH_EXCLUDE   1
+#define DO_MATCH_DIRECTORY 2
+
 /*
  * Does 'match' match the given name?
  * A match is found if
@@ -208,7 +211,7 @@ int within_depth(const char *name, int namelen,
  * It returns 0 when there is no match.
  */
 static int match_pathspec_item(const struct pathspec_item *item, int prefix,
-                              const char *name, int namelen)
+                              const char *name, int namelen, unsigned flags)
 {
        /* name/namelen has prefix cut off by caller */
        const char *match = item->match + prefix;
@@ -218,7 +221,7 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
         * The normal call pattern is:
         * 1. prefix = common_prefix_len(ps);
         * 2. prune something, or fill_directory
-        * 3. match_pathspec_depth()
+        * 3. match_pathspec()
         *
         * 'prefix' at #1 may be shorter than the command's prefix and
         * it's ok for #2 to match extra files. Those extras will be
@@ -257,7 +260,11 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
 
                if (match[matchlen-1] == '/' || name[matchlen] == '/')
                        return MATCHED_RECURSIVELY;
-       }
+       } else if ((flags & DO_MATCH_DIRECTORY) &&
+                  match[matchlen - 1] == '/' &&
+                  namelen == matchlen - 1 &&
+                  !ps_strncmp(item, match, name, namelen))
+               return MATCHED_EXACTLY;
 
        if (item->nowildcard_len < item->len &&
            !git_fnmatch(item, match, name,
@@ -282,12 +289,12 @@ static int match_pathspec_item(const struct pathspec_item *item, int prefix,
  * pathspec did not match any names, which could indicate that the
  * user mistyped the nth pathspec.
  */
-static int match_pathspec_depth_1(const struct pathspec *ps,
-                                 const char *name, int namelen,
-                                 int prefix, char *seen,
-                                 int exclude)
+static int do_match_pathspec(const struct pathspec *ps,
+                            const char *name, int namelen,
+                            int prefix, char *seen,
+                            unsigned flags)
 {
-       int i, retval = 0;
+       int i, retval = 0, exclude = flags & DO_MATCH_EXCLUDE;
 
        GUARD_PATHSPEC(ps,
                       PATHSPEC_FROMTOP |
@@ -327,7 +334,8 @@ static int match_pathspec_depth_1(const struct pathspec *ps,
                 */
                if (seen && ps->items[i].magic & PATHSPEC_EXCLUDE)
                        seen[i] = MATCHED_FNMATCH;
-               how = match_pathspec_item(ps->items+i, prefix, name, namelen);
+               how = match_pathspec_item(ps->items+i, prefix, name,
+                                         namelen, flags);
                if (ps->recursive &&
                    (ps->magic & PATHSPEC_MAXDEPTH) &&
                    ps->max_depth != -1 &&
@@ -350,15 +358,19 @@ static int match_pathspec_depth_1(const struct pathspec *ps,
        return retval;
 }
 
-int match_pathspec_depth(const struct pathspec *ps,
-                        const char *name, int namelen,
-                        int prefix, char *seen)
+int match_pathspec(const struct pathspec *ps,
+                  const char *name, int namelen,
+                  int prefix, char *seen, int is_dir)
 {
        int positive, negative;
-       positive = match_pathspec_depth_1(ps, name, namelen, prefix, seen, 0);
+       unsigned flags = is_dir ? DO_MATCH_DIRECTORY : 0;
+       positive = do_match_pathspec(ps, name, namelen,
+                                    prefix, seen, flags);
        if (!(ps->magic & PATHSPEC_EXCLUDE) || !positive)
                return positive;
-       negative = match_pathspec_depth_1(ps, name, namelen, prefix, seen, 1);
+       negative = do_match_pathspec(ps, name, namelen,
+                                    prefix, seen,
+                                    flags | DO_MATCH_EXCLUDE);
        return negative ? 0 : positive;
 }
 
diff --git a/dir.h b/dir.h
index 9b7e4e77d8b11bab92a91a6ce3e8920e50d23f9b..55e53456afab4c9fb8441144ac7393458b553006 100644 (file)
--- a/dir.h
+++ b/dir.h
@@ -132,9 +132,9 @@ struct dir_struct {
 extern int simple_length(const char *match);
 extern int no_wildcard(const char *string);
 extern char *common_prefix(const struct pathspec *pathspec);
-extern int match_pathspec_depth(const struct pathspec *pathspec,
-                               const char *name, int namelen,
-                               int prefix, char *seen);
+extern int match_pathspec(const struct pathspec *pathspec,
+                         const char *name, int namelen,
+                         int prefix, char *seen, int is_dir);
 extern int within_depth(const char *name, int namelen, int depth, int max_depth);
 
 extern int fill_directory(struct dir_struct *dir, const struct pathspec *pathspec);
@@ -205,4 +205,22 @@ extern int git_fnmatch(const struct pathspec_item *item,
                       const char *pattern, const char *string,
                       int prefix);
 
+static inline int ce_path_match(const struct cache_entry *ce,
+                               const struct pathspec *pathspec,
+                               char *seen)
+{
+       return match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen,
+                             S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode));
+}
+
+static inline int dir_path_match(const struct dir_entry *ent,
+                                const struct pathspec *pathspec,
+                                int prefix, char *seen)
+{
+       int has_trailing_dir = ent->len && ent->name[ent->len - 1] == '/';
+       int len = has_trailing_dir ? ent->len - 1 : ent->len;
+       return match_pathspec(pathspec, ent->name, len, prefix, seen,
+                             has_trailing_dir);
+}
+
 #endif
index 6cb9fd3014a424d11647e48de3b841012ccc2ffe..80430999553d8fda8d095b007bb08c1999bf6993 100644 (file)
@@ -33,7 +33,7 @@ void add_pathspec_matches_against_index(const struct pathspec *pathspec,
                return;
        for (i = 0; i < active_nr; i++) {
                const struct cache_entry *ce = active_cache[i];
-               match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, seen);
+               ce_path_match(ce, pathspec, seen);
        }
 }
 
index 8c44ceb2c715936b314fc10a7aae3dfb44172327..968ee25eae13f82fe4f93254d77660456732a5c6 100644 (file)
@@ -3,6 +3,7 @@
  */
 #include "cache.h"
 #include "pathspec.h"
+#include "dir.h"
 
 #ifdef NO_PTHREADS
 static void preload_index(struct index_state *index,
@@ -53,7 +54,7 @@ static void *preload_thread(void *_data)
                        continue;
                if (ce_uptodate(ce))
                        continue;
-               if (!ce_path_match(ce, &p->pathspec))
+               if (!ce_path_match(ce, &p->pathspec, NULL))
                        continue;
                if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))
                        continue;
index 71f64f3a6eee9ccb2abd9d78f42e03a810bb560b..29c1047eeb7ce69d6a196ec80c23f66472142273 100644 (file)
@@ -730,11 +730,6 @@ int ce_same_name(const struct cache_entry *a, const struct cache_entry *b)
        return ce_namelen(b) == len && !memcmp(a->name, b->name, len);
 }
 
-int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
-{
-       return match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL);
-}
-
 /*
  * We fundamentally don't like some paths: we don't want
  * dot or dot-dot anywhere, and for obvious reasons don't
@@ -1157,8 +1152,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
                if (ignore_submodules && S_ISGITLINK(ce->ce_mode))
                        continue;
 
-               if (pathspec &&
-                   !match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, seen))
+               if (pathspec && !ce_path_match(ce, pathspec, seen))
                        filtered = 1;
 
                if (ce_stage(ce)) {
index 1f2d21a72f56a68a7f9307bfd9092087687cffae..d55aa8a01b4a4f200f24972795f2887644a06d43 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -672,8 +672,8 @@ int rerere_forget(struct pathspec *pathspec)
        find_conflict(&conflict);
        for (i = 0; i < conflict.nr; i++) {
                struct string_list_item *it = &conflict.items[i];
-               if (!match_pathspec_depth(pathspec, it->string, strlen(it->string),
-                                         0, NULL))
+               if (!match_pathspec(pathspec, it->string,
+                                   strlen(it->string), 0, NULL, 0))
                        continue;
                rerere_forget_one_path(it->string, &merge_rr);
        }
index 49ebaaf8d8b269b374ad3ccbfc57acccd83fe006..44c697c36d0b406330aeb084db1d6a4be715d6c6 100644 (file)
@@ -185,7 +185,7 @@ void unmerge_index(struct index_state *istate, const struct pathspec *pathspec)
 
        for (i = 0; i < istate->cache_nr; i++) {
                const struct cache_entry *ce = istate->cache[i];
-               if (!match_pathspec_depth(pathspec, ce->name, ce_namelen(ce), 0, NULL))
+               if (!ce_path_match(ce, pathspec, NULL))
                        continue;
                i = unmerge_index_entry_at(istate, i);
        }
index a0df72f32c100a68e5d99b5b00e597d43f3802a5..f40ccf14269a3325f4f3069ce931bb73e1d1f27e 100644 (file)
@@ -16,6 +16,7 @@
 #include "line-log.h"
 #include "mailmap.h"
 #include "commit-slab.h"
+#include "dir.h"
 
 volatile show_early_output_fn_t show_early_output;
 
@@ -1400,7 +1401,7 @@ static void prepare_show_merge(struct rev_info *revs)
                const struct cache_entry *ce = active_cache[i];
                if (!ce_stage(ce))
                        continue;
-               if (ce_path_match(ce, &revs->prune_data)) {
+               if (ce_path_match(ce, &revs->prune_data, NULL)) {
                        prune_num++;
                        prune = xrealloc(prune, sizeof(*prune) * prune_num);
                        prune[prune_num-2] = ce->name;
index 9f5659f7fe4df23d805e6c38264a1ebf38fc2538..2bb973655bf043cc43292764ffd68becda25aa2e 100755 (executable)
@@ -140,4 +140,10 @@ test_expect_success 'diff multiple wildcard pathspecs' '
        test_cmp expect actual
 '
 
+test_expect_success 'diff-cache ignores trailing slash on submodule path' '
+       git diff --name-only HEAD^ submod >expect &&
+       git diff --name-only HEAD^ submod/ >actual &&
+       test_cmp expect actual
+'
+
 test_done
index a7c7ff5f4938c1fa7439e7c5a45321572bfc55fe..39fc3f6769be1c41d76c6acbfcb780b823afe7e7 100755 (executable)
@@ -69,7 +69,7 @@ test_expect_success 'tree_entry_interesting matches :(icase)bar with empty prefi
        test_cmp expect actual
 '
 
-test_expect_success 'match_pathspec_depth matches :(icase)bar' '
+test_expect_success 'match_pathspec matches :(icase)bar' '
        cat <<-EOF >expect &&
        BAR
        bAr
@@ -79,7 +79,7 @@ test_expect_success 'match_pathspec_depth matches :(icase)bar' '
        test_cmp expect actual
 '
 
-test_expect_success 'match_pathspec_depth matches :(icase)bar with prefix' '
+test_expect_success 'match_pathspec matches :(icase)bar with prefix' '
        cat <<-EOF >expect &&
        fOo/BAR
        fOo/bAr
@@ -89,7 +89,7 @@ test_expect_success 'match_pathspec_depth matches :(icase)bar with prefix' '
        test_cmp expect actual
 '
 
-test_expect_success 'match_pathspec_depth matches :(icase)bar with empty prefix' '
+test_expect_success 'match_pathspec matches :(icase)bar with empty prefix' '
        cat <<-EOF >expect &&
        bar
        fOo/BAR
index 4e5581005936a1e7832e3ab224cfe142ac777a63..a452407dad51940576db64b56d3a56cc7b364835 100644 (file)
@@ -510,7 +510,7 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
                struct wt_status_change_data *d;
                const struct cache_entry *ce = active_cache[i];
 
-               if (!ce_path_match(ce, &s->pathspec))
+               if (!ce_path_match(ce, &s->pathspec, NULL))
                        continue;
                it = string_list_insert(&s->change, ce->name);
                d = it->util;
@@ -552,7 +552,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
        for (i = 0; i < dir.nr; i++) {
                struct dir_entry *ent = dir.entries[i];
                if (cache_name_is_other(ent->name, ent->len) &&
-                   match_pathspec_depth(&s->pathspec, ent->name, ent->len, 0, NULL))
+                   dir_path_match(ent, &s->pathspec, 0, NULL))
                        string_list_insert(&s->untracked, ent->name);
                free(ent);
        }
@@ -560,7 +560,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
        for (i = 0; i < dir.ignored_nr; i++) {
                struct dir_entry *ent = dir.ignored[i];
                if (cache_name_is_other(ent->name, ent->len) &&
-                   match_pathspec_depth(&s->pathspec, ent->name, ent->len, 0, NULL))
+                   dir_path_match(ent, &s->pathspec, 0, NULL))
                        string_list_insert(&s->ignored, ent->name);
                free(ent);
        }