Brandon Williams <[email protected]> writes:

> @@ -671,12 +707,29 @@ static int grep_tree(struct grep_opt *opt, const struct 
> pathspec *pathspec,
>       enum interesting match = entry_not_interesting;
>       struct name_entry entry;
>       int old_baselen = base->len;
> +     struct strbuf name = STRBUF_INIT;
> +     int name_base_len = 0;
> +     if (super_prefix) {
> +             strbuf_addstr(&name, super_prefix);
> +             name_base_len = name.len;
> +     }
>  
>       while (tree_entry(tree, &entry)) {
>               int te_len = tree_entry_len(&entry);
>  
>               if (match != all_entries_interesting) {
> -                     match = tree_entry_interesting(&entry, base, tn_len, 
> pathspec);
> +                     strbuf_setlen(&name, name_base_len);
> +                     strbuf_addstr(&name, base->buf + tn_len);
> +
> +                     if (recurse_submodules && S_ISGITLINK(entry.mode)) {
> +                             strbuf_addstr(&name, entry.path);
> +                             match = submodule_path_match(pathspec, name.buf,
> +                                                          NULL);

The vocabulary from submodule_path_match() returns is the same as
that of do_match_pathspec() and match_pathspec_item() which is
MATCHED_{EXACTLY,FNMATCH,RECURSIVELY}, which is different from the
vocabulary of the variable "match" which is "enum interesting" that
is used by the tree-walk infrastructure.

I doubt they are compatible to be usable like this.  Am I missing
something?

> +                     } else {
> +                             match = tree_entry_interesting(&entry, &name,
> +                                                            0, pathspec);
> +                     }
> +
>                       if (match == all_entries_not_interesting)
>                               break;
>                       if (match == entry_not_interesting)

Reply via email to