diff options
| author | Junio C Hamano <gitster@pobox.com> | 2014-02-27 14:01:15 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2014-02-27 14:01:15 -0800 |
| commit | cbaeafc3251d08b479c5eb735444bb6ad6210c93 (patch) | |
| tree | 5513bd0aab1246167f737639e72022c0de64b1a6 /builtin/grep.c | |
| parent | 156d6ed9221ff38c4cd3bfcfc6778e31c104fd9b (diff) | |
| parent | 2e70c01799bf663cc1fa5f6e37e025000ffdc0b0 (diff) | |
| download | git-cbaeafc3251d08b479c5eb735444bb6ad6210c93.tar.gz | |
Merge branch 'nd/submodule-pathspec-ending-with-slash'
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()
Diffstat (limited to 'builtin/grep.c')
| -rw-r--r-- | builtin/grep.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index 63f86032d9..69ac2d8797 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -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) |
