Re: [PATCH] grep: use grep_opt->repo instead of explict repo argument
- From
Stefan Beller <sbeller@google.com>
- Date
- Nov 26, 2018, 19:52 UTC
- Message-ID
- <CAGZ79kZHFxahZMAZh2Ldscfqp0OWAae7dowAboLDac-UmTHwYw@mail.gmail.com>
- In-Reply-To
- <20181118163851.32178-1-pclouds@gmail.com>
On Sun, Nov 18, 2018 at 8:38 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 12 quoted lines
> > This command is probably the first one that operates on a repository > other than the_repository, in f9ee2fcdfa (grep: recurse in-process > using 'struct repository' - 2017-08-02). An explicit 'struct > repository *' was added in that commit to pass around the repository > that we're supposed to grep from. > > Since 38bbc2ea39 (grep.c: remove implicit dependency on the_index - > 2018-09-21). 'struct grep_opt *' carries in itself a repository > parameter for grepping. We should now be able to reuse grep_opt to > hold the submodule repo instead of a separate argument, which is just > room for mistakes.
That makes sense. Assuming we did not make a mistake yet, the test suite would not need changes (further assuming we do test for it, but we do as we have explicit submodule grep tests).
Show 6 quoted lines
> > While at there, use the right reference instead of the_repository and > the_index in this code. I was a bit careless in my attempt to kick > the_repository / the_index out of library code. It's normally safe to > just stick the_repository / the_index in bultin/ code, but it's not > the case for grep.
Reviewed-by: Stefan Beller <sbeller@google.com>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>