Brandon Williams <bmw...@google.com> writes:

>       /* Add super prefix */
> +     quote_path_relative(name, opt->prefix, &buf);

Hmph, do you want a quoted version here, not just relative_path()?

Perhaps add a test with an "unusual" byte (e.g. a double-quote) in
the path?

>       argv_array_pushf(&cp.args, "--super-prefix=%s%s/",
>                        super_prefix ? super_prefix : "",
> -                      name);
> +                      buf.buf);
> +     strbuf_release(&buf);
>       argv_array_push(&cp.args, "grep");
>  
>       /*
> @@ -1199,7 +1202,8 @@ int cmd_grep(int argc, const char **argv, const char 
> *prefix)
>  
>       parse_pathspec(&pathspec, 0,
>                      PATHSPEC_PREFER_CWD |
> -                    (opt.max_depth != -1 ? PATHSPEC_MAXDEPTH_VALID : 0),
> +                    (opt.max_depth != -1 ? PATHSPEC_MAXDEPTH_VALID : 0) |
> +                    (super_prefix ? PATHSPEC_FROMROOT : 0),
>                      prefix, argv + i);
>       pathspec.max_depth = opt.max_depth;
>       pathspec.recursive = 1;
> diff --git a/t/t7814-grep-recurse-submodules.sh 
> b/t/t7814-grep-recurse-submodules.sh
> index 418ba68fe..e0932b2b7 100755
> --- a/t/t7814-grep-recurse-submodules.sh
> +++ b/t/t7814-grep-recurse-submodules.sh
> @@ -227,7 +227,7 @@ test_expect_success 'grep history with moved submoules' '
>       test_cmp expect actual
>  '
>  
> -test_expect_failure 'grep using relative path' '
> +test_expect_success 'grep using relative path' '
>       test_when_finished "rm -rf parent sub" &&
>       git init sub &&
>       echo "foobar" >sub/file &&

Reply via email to